I spend some time making a few changes with the blog look and feel – customizing thing around – I especially like the social sharing icons I put down there – gives the blog a lot more color! I wonder if there is a hint hidden here :). Folks time to get on with the next question.
If you haven't had a look at the previous puzzle – do have a look at it before you begin this one!
For the rest – getting a feeling of Deja-Vu? Think you have seen this puzzle before? – you have it's the same question as the previous one. Ditto – Same.
package com.twisters;
public class UnIncrement{
public static void main(String[] args) {
int x = 0;
x++;
System.out.println("X is : " + x);//This must print 'X is 0'
}
}
Get the System.out.prinltn() to print 'X is 0' at line 6.
You may add (but not delete) any additional amount of code.
(Same lines – thats because I copy pasted them!!!)
Here the change – the puzzle a lot simpler now. My clause "You can just add one character to the above code to get it to work - any one character but that all"
Site of the day - http://interviewpattern.com/post/Puzzles-and-Riddles-on-the-interview-(Part-e28093-I).aspx. If you like analytical puzzles you might enjoy the post!
Got an answer? Do leave it here.