-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProject15_AdvanceJava.java
More file actions
57 lines (42 loc) · 1.34 KB
/
Project15_AdvanceJava.java
File metadata and controls
57 lines (42 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package com.company;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
public class Project15_AdvanceJava {
public static void main(String[] args) {
// 1.
ArrayList<String> Students = new ArrayList<>();
Students.add("Abhay");
Students.add("Palak");
Students.add("Ashu");
Students.add("Bittu");
Students.add("Shiv");
Students.add("Shubh");
Students.add("Aryan");
Students.add("Jay");
Students.add("Dhruv");
Students.add("Shourya");
for (Object o: Students) {
System.out.println(o);
}
// 2.
Date d = new Date();
System.out.println(d.getHours() + ":" + d.getMinutes() + ":" + d.getSeconds());
// 3.
Calendar c = Calendar.getInstance();
System.out.println(Calendar.HOUR + ":" + Calendar.MINUTE + ":" + Calendar.SECOND);
// 4.
LocalDateTime dt = LocalDateTime.now();
DateTimeFormatter df = DateTimeFormatter.ofPattern("dd/MM/yyyy" + " " + "hh:mm:ss");
String format = dt.format(df);
System.out.println(format);
// 5.
HashSet<Integer> h = new HashSet<>();
h.add(5);
h.add(4);
h.add(8);
h.add(3);
h.add(5);
System.out.println(h);
}
}