Skip to content

Instantly share code, notes, and snippets.

@alexandreaquiles
Created August 16, 2017 15:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexandreaquiles/7eb3d21b9a41df0b93a6d962260cbde9 to your computer and use it in GitHub Desktop.
Save alexandreaquiles/7eb3d21b9a41df0b93a6d962260cbde9 to your computer and use it in GitHub Desktop.
class A {
static int x() {
return 1;
}
}
class B extends A {
static int x() {
return 2;
}
}
A a = new A();
B b = new B();
A ab = new B();
a.x(); //1
b.x(); //2
ab.x(); //1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment