Overridden methods of super class can be accessed from a child class using the keyword super but the child class method that is invoking the super class method must be non-static. How can I invoke super class overridden from a static method of child class.
class TakeMe{
void display(){
System.out.println("In super");
}
}
public class Inher extends TakeMe{
void display(){
System.out.println("In child");
}
public static void main(String[] args) {
Inher obj = new Inher();
super.display(); //Error here
}
}
This shows error Cannot use super in a static contextJava(536871112)
obj.super.display() doesn't work
What you need is following;