-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathenumDataType.java
More file actions
45 lines (40 loc) · 1.19 KB
/
Copy pathenumDataType.java
File metadata and controls
45 lines (40 loc) · 1.19 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
enum Dept{
CS("john","Block A"),IT("raju","Block B"),CIVIL("sham","Block C"),ECE("Reyaz","Block C");
// private Dept(){
// System.out.println(this.name());
// }
String head;
String location;
private Dept(String head ,String loc){
this.head=head;
this.location=loc;
}
public String getHead(){
return head;
}
public String getLocation(){
return location;
}
}
public class enumDataType {
public static void main(String[] args){
Dept d=Dept.CS;
// d.display();
// System.out.println(d.valueOf("ECE"));
// Dept list[]=Dept.values();
// for(Dept x:list)
// System.out.println(x);
// switch (d) {
// case CS:System.out.println("Head:john\nBlock:A");
// break;
// case IT:System.out.println("Head:Smith\nBlock:B");
// break;
// case CIVIL:System.out.println("Head: David\nBlock:C");
// break;
// case ECE:System.out.println("Head:Reyaz\nBlock:D");
// break;
// }
System.out.println(d.getHead());
System.out.println(d.getLocation());
}
}