Created
February 13, 2015 18:01
-
-
Save benjholla/8700d7314b5b990cf461 to your computer and use it in GitHub Desktop.
An Java inner class that extends its outer class (cause...why not?)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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