public class Typsicherheit { private enum Fahrzeug {AUTO, LKW} private static int AUTO = 0; private static int LKW = 2; private static int SCHREINER = 0; private static int METZGER = 1; public static void main(String[] args) { int fahrzeug; fahrzeug = AUTO; // ok System.out.println("Fahrzeug: " + fahrzeug); fahrzeug = METZGER; // ok, aber falsche Zuweisung System.out.println("Fahrzeug: " + fahrzeug); // fahrzeug = Fahrzeug.AUTO; // Compile-Error Fahrzeug vehicle; vehicle = Fahrzeug.AUTO; // ok System.out.println("Fahrzeug: " + vehicle); } }