| Author |
enum question from K&B
|
Monica Dharwad
Greenhorn
Joined: Aug 14, 2006
Posts: 8
|
|
in the following program, why is static main method able to access non static enum?
public class TestDays {
enum Days { MON, TUE, WED};
public static void main(String[] args) {
// TODO Auto-generated method stub
for(Days d : Days.values())
;
Days [] d2 = Days.values();
System.out.println(d2[2]);
}
}
|
 |
Vishwanath Krishnamurthi
Ranch Hand
Joined: Jun 04, 2007
Posts: 331
|
|
Nested enums are implicitly static.
HTH,
Vishwa
|
Blog
|
 |
 |
I agree. Here's the link: jrebel
|
|
subject: enum question from K&B
|
|
|