Skip to content

Instantly share code, notes, and snippets.

@asicfr

asicfr/Test.java

Created Jun 1, 2016
Embed
What would you like to do?
The distinction between hiding and overriding method
class A {
public static void display() {
System.out.println("Inside static method of superclass");
}
}
class B extends A {
public void show() {
display();
}
public static void display() {
System.out.println("Inside static method of this class");
}
}
public class Test {
public static void main(String[] args) {
B b = new B();
b.display();
A a = new B();
a.display();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.