-
-
Save benjholla/b3f234b30ad2eb7b75ad3a8662435c8a to your computer and use it in GitHub Desktop.
Java Puzzle 18
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 Puzzle18 { | |
public static void main(String[] args){ | |
A answer = new B(); | |
System.out.println("Is the second exam comprehensive?"); | |
answer.print(); | |
} | |
public static class A extends Object { | |
public void print() { | |
System.out.println("Yes."); | |
} | |
} | |
public static class B extends A { | |
public void print() { | |
System.out.println("Yes kind of, but that wasn't the goal."); | |
} | |
} | |
public static class C extends B { | |
public void print() { | |
System.out.println("No, but you should understand everything..."); | |
} | |
} | |
public static class D extends Object { | |
public void print() { | |
System.out.println("I'm not sure, I haven't made it yet..."); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment