Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.