SuperClass2

Class cls = java.lang.String.class;
Class sup = cls.getSuperclass();  // java.lang.Object

cls = java.lang.Object.class;
sup = cls.getSuperclass();        // null

// The superclass of interfaces is always null
cls = java.lang.Cloneable.class;
sup = cls.getSuperclass();        // null

// The superclass of primitive types is always null
cls = int.class;
sup = cls.getSuperclass();        // null

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.