Answers for "java lang classcast exception"

3

classcastexception in java

Object someStringAsObject="Hello";
String asString=(String)someStringAsObject;//works
Integer asInteger=(Integer)someStringAsObject;//throws ClassCastException because it is a String and not an Integer
Posted by: Guest on April-04-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language