public class EnumEx2 {
public static void main(String[] args) {
System.out.println(CarEnum12.valueOf("BMW"));
for (CarEnum12 c:CarEnum12.values())
System.out.println(c.getCarType());
}
}
enum CarEnum12 {
BMW("Bavarian Motor Works"),
TOYOTA("Too Often Yankees Overprice This Auto"),
FIAT("Fabbrica Italiana Automobili Torino");
private String CarType;
private CarEnum12(String CarType) {
this.CarType = CarType;
}
public String getCarType() {
return CarType;
}
}
0 comments:
Post a Comment