Java Class Cast() MethodThe cast() method of java Class class casts an object to the class or interface represented by this Class object. SyntaxParameterobj - the object to be cast Returnsthe object after casting, or null if obj is null ThrowsClassCastException Example 1Test it NowOutput: class ClassasCastExample2 class Base class Derived class Base Example 2Test it NowOutput: class ClassasCastExample2 Class Derived Display() function class Base class Derived class Base Next TopicJava Class |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India