Skip to content

Instantly share code, notes, and snippets.

@benjholla
Created February 13, 2015 18:01
Show Gist options
  • Save benjholla/8700d7314b5b990cf461 to your computer and use it in GitHub Desktop.
Save benjholla/8700d7314b5b990cf461 to your computer and use it in GitHub Desktop.
An Java inner class that extends its outer class (cause...why not?)
public class InsideOut {
public static void main(String[] args){
System.out.println(new OutsideIn().toString());
}
public InsideOut() {}
@Override
public String toString(){
return "Outside";
}
public static class OutsideIn extends InsideOut {
public OutsideIn() {}
@Override
public String toString(){
return "Inside";
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment