Last change
on this file since 508cff0 was
7568e5c,
checked in by JiadaL <j82liang@…>, 3 months ago
|
Minor update on the thesis (add auto initialization and update future work
|
-
Property mode set to
100644
|
File size:
1.0 KB
|
Line | |
---|
1 | import java.io.*; |
---|
2 | |
---|
3 | public class test1 { |
---|
4 | enum Weekday { |
---|
5 | Mon(7), Tue(6), Wed(5), Thu(3), Fri(4), Sat(3), Sun(7); // must appear first |
---|
6 | private long day; |
---|
7 | private Weekday( long d ) { day = d; } |
---|
8 | } |
---|
9 | |
---|
10 | public static void main( String[] args ) { |
---|
11 | Weekday cday = Weekday.Sat; |
---|
12 | System.out.println( cday.ordinal() + " " + cday + " " + cday.name() ); // label |
---|
13 | |
---|
14 | if ( cday == Weekday.Fri ) { // position |
---|
15 | System.out.println( "true" ); |
---|
16 | } |
---|
17 | // if ( cday < Weekday.Sat ) { // no releation operations |
---|
18 | // System.out.println( "true" ); |
---|
19 | // } |
---|
20 | switch ( cday ) { // position |
---|
21 | case Mon: case Tue: case Wed: case Thu: case Fri: |
---|
22 | System.out.println( "weekday" ); |
---|
23 | break; |
---|
24 | case Sat: case Sun: |
---|
25 | System.out.println( "weekend" ); |
---|
26 | break; |
---|
27 | } |
---|
28 | for ( Weekday icday : Weekday.values() ) { // position |
---|
29 | System.out.println( icday + " " + icday.ordinal() + " " + icday.day + " " + icday.name() + ", " ); // label |
---|
30 | } |
---|
31 | System.out.println(); |
---|
32 | |
---|
33 | if (Weekday.Fri == Weekday.Sat) { |
---|
34 | System.out.println( "Alias "); |
---|
35 | } |
---|
36 | } |
---|
37 | } |
---|
38 | |
---|
39 | // java test1 |
---|
Note: See
TracBrowser
for help on using the repository browser.