-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHelloConstTest.java
More file actions
35 lines (28 loc) · 695 Bytes
/
HelloConstTest.java
File metadata and controls
35 lines (28 loc) · 695 Bytes
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
package control;
public class HelloConstTest {
private final String dy = "MONDAY";
public static void main(String[] args) {
HelloConstTest obj = new HelloConstTest();
obj.printWeek(Day.MONDAY);
// TEST EQUAL
Day mnd = Day.MONDAY;
boolean isEqual = (mnd == Day.MONDAY);
System.out.println(isEqual);
boolean isEq = (obj.dy == "ABC");
boolean isEqual2 = (Day.SUNDAY == Day.MONDAY); // Error
}
public void printWeek(Day day) {
System.out.println("Day is: ");
switch (day) {
case SUNDAY:
System.out.println(Day.SUNDAY);
break;
case MONDAY:
System.out.println(Day.MONDAY);
break;
default:
System.out.println("Day is not valid:");
break;
}
}
}