Online Java Compiler By
JavaTpoint.com
import java.lang.*; public class ClassgetSuperClassExample1 extends Object { public static void main(String args[]) { ClassgetSuperClassExample1 objsub = new ClassgetSuperClassExample1(); Class class1; class1 = objsub.getClass(); System.out.println("objsup1 is object of type = " + class1.getName()); class1 = class1.getSuperclass(); System.out.println("super class of objsup1 = " + class1.getName()); } }
Output