views:

51

answers:

1

In Java 1.4.2 and earlier versions, if you get a ClassCastException, you can see the exception stack trace but not the class name. If you want to find out the class of the object for which casting failed, you have to debug.

Is it still the same in later Java versions? If so, when did it change?

+4  A: 

This changed with Java5, when the exception message started including the actual name of the class of the object being cast. Should've been there from the start, it took them ages to add it.

skaffman