Skip to content

Instantly share code, notes, and snippets.

@jsyeo
Created August 17, 2015 01:05
Show Gist options
  • Select an option

  • Save jsyeo/71ab2a41076fbd21210e to your computer and use it in GitHub Desktop.

Select an option

Save jsyeo/71ab2a41076fbd21210e to your computer and use it in GitHub Desktop.
Subinterface for Class Hierarchy Analysis
public class Main {
public static void main(String[] args) {
SuperInterface a = new ImplementerA();
a.foo();
SuperInterface b = new ImplementerB();
b.foo();
}
}
class ImplementerB implements SubInterfaceB {
@Override
public void baz() {
}
@Override
public void foo() {
}
}
class ImplementerA implements SubInterfaceA {
@Override
public void bar() {
}
@Override
public void foo() {
}
}
interface SubInterfaceA extends SuperInterface {
void bar();
}
interface SubInterfaceB extends SuperInterface {
void baz();
}
interface SuperInterface {
void foo();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment