-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
|
||
import java.sql.*; | ||
import java.util.Scanner; | ||
|
||
public class SQLAssign { | ||
|
||
public static void main(String[] args) throws Exception { | ||
Class.forName("org.postgresql.Driver"); | ||
//System.out.println("Driver loaded"); | ||
Scanner ob = new Scanner(System.in); | ||
System.out.println("Enter username : "); | ||
String username = ob.next(); | ||
System.out.println("Enter password : "); | ||
String password = ob.next(); | ||
Connection conn = DriverManager.getConnection("jdbc:postgresql:https://localhost:5432/test", username, password); | ||
System.out.println("Connection Done!"); | ||
Statement stmt = conn.createStatement(); | ||
System.out.println("Enter query : "); | ||
String sql = ob.next(); | ||
stmt.executeUpdate(sql); | ||
System.out.println("Record Inserted"); | ||
conn.close(); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import java.sql.*; | ||
|
||
public class SQLDemo { | ||
public static void main(String[] args) throws Exception { | ||
Class.forName("org.postgresql.Driver"); | ||
System.out.println("Driver loaded"); | ||
Connection conn = DriverManager.getConnection("jdbc:postgresql:https://localhost:5432/test","postgres","789456"); | ||
System.out.println("Connection Done!"); | ||
Statement stmt = conn.createStatement(); | ||
String sql = "insert into student values(800,'XYZ')"; | ||
stmt.executeUpdate(sql); | ||
System.out.println("Record Inserted"); | ||
conn.close(); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import java.util.Scanner; | ||
public class WiproExamCode { | ||
public static double powFirst(int input1){ | ||
String s = Integer.toString(input1); | ||
int len = s.length(); | ||
double x = Integer.parseInt(s.charAt(0)+""); | ||
double y = Integer.parseInt(s.charAt(len-1)+""); | ||
double p = Math.pow(x,y); | ||
if(x==1){ | ||
return 1; | ||
}else{ | ||
return p; | ||
} | ||
} | ||
public static void main(String[] args) { | ||
Scanner ob = new Scanner(System.in); | ||
int i = ob.nextInt(); | ||
double x = WiproExamCode.powFirst(i); | ||
System.out.println(x); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.