class superClass {} class subClass extends superClass{} public class test { public static void main() { superClass sc1 = new subClass(); subClass sc
In addition to the above answers, because the constructed object is really an object of type SubClass you can cast it to SubClass and call the methods:
SubClass
SuperClass superClass = new SubClass(); superClass.method1(); ((SubClass)superClass).method2();