The answer to last weeks puzzle is 0. That’s right the minimum code change needed to get the code to print true is 0!!
Surprised – well let’s have a look at what the Java Docs have to say for the getBoolean() method -
"Returns true if and only if the system property named by the argument exists and is equal to the string true …" (read more).
To get the code to print true, we just need to run the program with the right command line arguments, namely,
java -Dfalse=true com.twister.MyTruth
You would find a good discussion on this topic here.
@Sebastian & Mohamed El-Beltagy – Good catch folks!!!
No comments:
Post a Comment
Solution for this question?