Java Puzzle 9: Tweet

Feb 02, 2015

Short but challenging, a puzzle that fits in a tweet, exploring the power a superclass has over its subclass:

Instructions:

  1. Copy-paste that code unchanged into B.java
  2. Write anything you want in A.java.
  3. Execute it with java -Djava.security.manager A. The security manager is there to avoid you cheat too much.
  4. If it reaches the statement that prints "Win" in B, then you won.
  5. Post your solution as a comment here below. The comments will not be visible yet, to give everyone a chance to solve it without seeing the solution. Compare your answer to the solution