Created
November 15, 2015 16:02
-
-
Save geakstr/b26c8eabb019b34fce79 to your computer and use it in GitHub Desktop.
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 HelloWorld { | |
static class A { | |
public A() { | |
System.out.println("A"); | |
} | |
} | |
static class B extends A {} | |
public static void main (String[] args) { | |
B b = new B(); // output: A | |
} | |
} | |
public class HelloWorld { | |
static class A { | |
public A() { | |
System.out.println("A"); | |
} | |
} | |
static class B extends A { | |
public B() { | |
System.out.println("B"); | |
} | |
} | |
public static void main (String[] args) { | |
B b = new B(); // output: A\nB | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment