-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTut32.java
More file actions
40 lines (33 loc) · 1.02 KB
/
Tut32.java
File metadata and controls
40 lines (33 loc) · 1.02 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
package tutorial;
import java.util.Date;
@FunctionalInterface // this is given when the interface contains only one function
interface ekinterface {
public void display();
}
//enum and annotations
public class Tut32 {
@SuppressWarnings({ "deprecation" }) // this will show to suppresswarning
public static void main(String[] args) {
Date dt = new Date();
System.out.println(dt.getMonth()); // getmonth method is deprecated so we will use the annotation suppersswaring
System.out.println(); // as the method is deprecated so you cannot use it any more
Accessingenum();
}
@Deprecated
public static void getname1() { // lets notify that this method is deprecated
System.out.println("prahtma");
}
// creation of enum
public enum Developer {
Prathamesh, Sushant, Lokesh
}
public static void Accessingenum() {
Developer dl = Developer.Lokesh;
System.out.println(dl);
// looping the enum
for (Developer d : Developer.values()) {
System.out.println(d);
}
// System.out.println(Developer.valueOf(1));
}
}