OnJava8-Examples/enums/NotClasses.java

40 lines
992 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
// <20>2015 MindView LLC: see Copyright.txt
// {Exec: javap -c LikeClasses}
import static com.mindviewinc.util.Print.*;
enum LikeClasses {
WINKEN {
@Override
void behavior() { print("Behavior1"); }
},
BLINKEN {
@Override
void behavior() { print("Behavior2"); }
},
NOD {
@Override
void behavior() { print("Behavior3"); }
};
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
*/