Twisters were started with the objective of having cute Java puzzles – puzzles that are based on really simple principles yet stubble enough to make you pause and think.
However somewhere down the line I though some of the puzzle were too simple – you could just pick the code compile it and punch in the output as the answer. I decided to raise the bar a bit and see how things go.
So here the first puzzle of the new series Code Complete (well its called code complete – because that's what you have to do - complete the code!)
package com.twisters;
interface TwistedInterface{void getA();}
public class TwistedClass implements TwistedInterface {
public static void main(String[] args) {
System.out.println("In Main");
}
}
Get this code to compile - You may add (but not delete) any additional amount of code you like with one exception -
you may not implement the getA() method inside the TwistedClass. Feel free to make any other additions!
Commenting out any existing code - is considered as deleting. Cute statements like public class Twisted /*implements TwistedInterface*/ don't count as correct answer thought I really do appreciate ingenuity! -:)
I think this is a tough puzzle – in case you disagree you might want to leave your solution here.
I'd like feedback for this particular puzzle – is it hard or still too easy? Feedback is as always highly appreciated!