+ 4
Can you solve this Java code? Surprise Answer
/*what comes in the blank underscore, if this is a valid code. Read the question carefully, if you dont know, dont downvote....*/ int x = 2_0_1__6; System.out.print(x+1); //2017 was the output produced //NO ARITHMETIC OPERATORS WERE USED //you will be surprised by the answer.
12 Answers
+ 3
Java allows underscore within literals.
int x = 123_45___8;
will work.
x will be 123458;
So, the code itself is correct. Or Underscore should come in the place of underscores.
+ 7
int x = 200+1816;
+ 7
@food
don't know java, but it simply prints x+1 which is 2016+1
+ 5
@food don't let Einstein be criticised for me!!!!!!
and by the way , your question says "blank underscore" so they are blank.....their are nothing in their places........so the statement simply is
int x = 2016;
+ 5
@food....๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐.......AWESOME........
but donโt try to criticise Einstein for me!!!!!!!!
+ 3
ok some hint needed!!!!
+ 1
ha ha ha there is one einstein...
honestly, that was not my intention.
but there is another answer. so simple answer.
find it,
+ 1
@Chirag Ghosh I want you to find the answer Einstein. You made it that time. But operators not allowed. I should have mentioned that, that day. Cmon try it. for me
+ 1
@Chirag Ghosh ok ok answer inside question itself. pls find it, I am waiting..
If you dont find it, then you leave me no choice than changing the question to "Even Einstein can't solve this"
+ 1
@Chirag Ghosh run that piece of code as is. You will see the answer.
+ 1
@Chirag Ghosh Hi, I never meant that (seriously). But seriously, I was just kidding.
+ 1
2017 right answer