Skip to content

Instantly share code, notes, and snippets.

View devDeejay's full-sized avatar
🏠
Working from home

Dhananjay Trivedi devDeejay

🏠
Working from home
View GitHub Profile
// 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;
//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
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);
public class StormTrooper implements Cloneable {
String color = "White";
String master = "Darth Vader";
StormTrooper() {
System.out.println("Welcome to the Dark Side");
}
public class StormTrooper implements Cloneable {
String color = "White";
String master = "Darth Vader";
StormTrooper() {
System.out.println("Welcome to the Dark Side");
}
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) {
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();
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();
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;
class KotlinClass(var id: Long, var name: String, var url: String, var mbid: String)