Monday, March 2, 2009

enum switch



enum Beer
{
KF,RC,H5;
}
class EnumSwitch
{
public static void main(String arg[])
{
Beer b=Beer.KF;
switch(b)
{
case KF:
System.out.println("too Bitter");
break;
case RC:
System.out.println("too Hot");
break;
case H5:
System.out.println("too strong");
break;
}
}
}

output:
too Bitter



0 comments:

Post a Comment