Sat Aug 29, 2009 12:10 pm
public class EnumTest {
enum Food {
BREAD("BREAD"),CHEESE("CHEESE"),MEAT("MEAT");
private String myfood;
Food(String s)
{
myfood = s ;
}
public String getValue()
{
return myfood ;
}
}
public static void main(String args[])
{
System.out.println(Food.BREAD.myfood+" "+Food.BREAD+" "+Food.values());
new EnumTest2();
}
}
class EnumTest2 {
EnumTest2()
{
System.out.println(EnumTest.Food.BREAD);
}
}
BREAD BREAD [LEnumTest$Food;@11b86e7
BREAD
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.