classcastexception in java

Solutions on MaxInterview for classcastexception in java by the best coders in the world

showing results for - "classcastexception in java"
Ida
04 Mar 2020
1Object someStringAsObject="Hello";
2String asString=(String)someStringAsObject;//works
3Integer asInteger=(Integer)someStringAsObject;//throws ClassCastException because it is a String and not an Integer