We inherit the class Super in class Sub using the concept of Inheritance. Due to which all the Methods and Instance Variable of class Super (which are not private)are available to class Sub and we can directly use the Methods and Instance Variable without using Super Keyword.
Here is the source code of the Java Program to Access the Super Class Method and Instance Variable Without Using Super Keyword from Sub Class. The Java program is successfully compiled and run on a Windows system. The program output is also shown below.
int a = 5, b = 6;
int c = a + b;
public class Sub extends Super
public static void main(String args)
Sub obj = new Sub();
$ javac Sub.java $ java Sub a:5 b:6 Result:11
Sanfoundry Global Education & Learning Series – 1000 Java Programs.