OnJava8-Examples/enums/NotClasses.java

38 lines
946 B
Java
Raw Normal View History

2015-09-07 11:44:36 -06:00
// enums/NotClasses.java
2015-06-15 17:47:35 -07:00
// {Exec: javap -c LikeClasses}
enum LikeClasses {
WINKEN {
@Override
2015-11-03 12:00:44 -08:00
void behavior() { System.out.println("Behavior1"); }
2015-06-15 17:47:35 -07:00
},
BLINKEN {
@Override
2015-11-03 12:00:44 -08:00
void behavior() { System.out.println("Behavior2"); }
2015-06-15 17:47:35 -07:00
},
NOD {
@Override
2015-11-03 12:00:44 -08:00
void behavior() { System.out.println("Behavior3"); }
2015-06-15 17:47:35 -07:00
};
abstract void behavior();
}
public class NotClasses {
// void f1(LikeClasses.WINKEN instance) {} // Nope
2015-09-07 11:44:36 -06:00
}
/* Output: (First 12 Lines)
2015-06-15 17:47:35 -07:00
Compiled from "NotClasses.java"
abstract class LikeClasses extends
java.lang.Enum<LikeClasses> {
public static final LikeClasses WINKEN;
public static final LikeClasses BLINKEN;
public static final LikeClasses NOD;
public static LikeClasses[] values();
Code:
0: getstatic #2 // Field
$VALUES:[LLikeClasses;
3: invokevirtual #3 // Method
"[LLikeClasses;".clone:()Ljava/lang/Object;
...
2015-09-07 11:44:36 -06:00
*/