Java-getClass

getClass The getClass() method returns the runtime class of an object. The getSuperclass() method returns the Class representing the superclass of the entity represented by this Class. Program Program Source class Data1 { } class Data2 extends Data1 { } class Javaapp { public static void main(String args[]) { Data2 d2 = new Data2(); System.out.println(“Data2 Superclass is : “+d2.getClass().getSuperclass()); … Read more…