This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Printing Message To Get User Input In Specified Format | |
System.out.println("Enter Date In Format : DD-MM-YYYY"); | |
String inputStringDate = input.next(); | |
System.out.println("You entered " + inputStringDate); | |
// Define The Format Of Date as dd-MM-yyyy (As per your requirements) | |
SimpleDateFormat format = new SimpleDateFormat("dd-MM-yyyy"); | |
java.util.Date parsedDate = null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Declaring sql Date variable | |
java.sql.Date sqlDate; | |
// 'sqlDate' will hold the SQL Date | |
// BTW this is how you set current system time into an SQL Date | |
sqlDate = new java.sql.Date(System.currentTimeMillis()); | |
// Printing date |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void main(String[] args) throws CloneNotSupportedException { | |
StormTrooper stormTrooper1 = new StormTrooper(); | |
StormTrooper stormTrooper2 = stormTrooper1; | |
StormTrooper stormTrooper3 = (StormTrooper) stormTrooper1.clone(); | |
// Default Master is Darth Vader | |
// Default color is White | |
System.out.println("StormTrooper 1 : " + stormTrooper1.master + " : " + stormTrooper1.color); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class StormTrooper implements Cloneable { | |
String color = "White"; | |
String master = "Darth Vader"; | |
StormTrooper() { | |
System.out.println("Welcome to the Dark Side"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class StormTrooper implements Cloneable { | |
String color = "White"; | |
String master = "Darth Vader"; | |
StormTrooper() { | |
System.out.println("Welcome to the Dark Side"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Arrays; | |
import java.util.List; | |
public class Demo { | |
public static void main(String[] args) { | |
String[] array = {"Hello", "World"}; | |
List<String> list = Arrays.asList(array); | |
for (String s : list) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
public class test { | |
public static void main(String[] args) { | |
long startTime = System.currentTimeMillis(); | |
int count = 0; | |
Scanner in = new Scanner(System.in); | |
ArrayList list = new ArrayList(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class test_improved_hash { | |
public static void main(String[] args) { | |
int count = 0; | |
Scanner in = new Scanner(System.in); | |
HashSet<Integer> hashSet = new HashSet<>(); | |
int n = in.nextInt(); | |
int m = in.nextInt(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class JavaClass { | |
long id; | |
String name; | |
String url; | |
String mbid; | |
public JavaClass(long id, String name, String url, String mbid) { | |
this.id = id; | |
this.name = name; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class KotlinClass(var id: Long, var name: String, var url: String, var mbid: String) |
OlderNewer