Hi, everybody.
I want to know to what type of class references can a Object class type be cast without giving a ClassCastException at runtime.
eg : Object obj="Amit";
Integer x=(Integer)obj;//gives a ClassCastException. Why?
String y=(String) obj; // does not give a Runtime error.