indra negi wrote:
Should it not give compile time error at line no. 20.
here the main() method is inside the same class in which you have declared the enum....
i suppose that you already knew that its perfectly legal to access a private member inside the class in which it is declared....
adding to it you should know that all enums are almost like classes which implicitly extend java.lang.Enum and that their constructors can't be invoked explicitly.....
i suppose that you will understand this clearly...
KARTHICK.C , SCJP6-93%
(Born to Win)
Joined: Aug 12, 2009
Thanks Thomas and Karthick. You are right. I got it.
Well this is the default value returned by the toString method. You don't need to understand @1372a1a came from. Before it is the enum name (Bridge is the containing class of Suits enum so Bridge$Suits) and after that is a hash code. If a question like this comes, you just have to know that there is a weird looking value that the default toString method returns...