Post

🌒 Eclipse IDE
🌒 Eclipse IDE@EclipseJavaIDE·
What's the output of this guy here? (don't cheat;)
🌒 Eclipse IDE tweet media
English
17
6
27
0
🌒 Eclipse IDE
🌒 Eclipse IDE@EclipseJavaIDE·
So Java doesn't do implicit integer-to-boolean (0 - false and 1 - true). Thus you get a compile error here. @i_sopov got there first!
English
1
0
7
0
luke
luke@LukeMoll_·
@EclipseJavaIDE (not cheating) does Java do a sort of zero -> false, nonzero -> true kinda thing? In which case it'd print "-1" since the loop condition isn't true on the first iteration, and s is never increased
English
0
0
2
0
Bonfra
Bonfra@Bonfra04·
@EclipseJavaIDE should’t compile: 0 = false; 1>= true; -1 <= error;
English
0
0
0
0
Paneendranatha Reddy
Paneendranatha Reddy@yerragudiPhani·
@EclipseJavaIDE Get compile time error because in the if condition it will check for boolean value. But we are giving integer
English
0
0
0
0
Naveen
Naveen@NaveenRedd777·
@EclipseJavaIDE Compilation Error as condtitional expression is missing in for loop
English
0
0
0
0
Vijaykumar Nanikeri
Vijaykumar Nanikeri@VJKumarNanikeri·
@EclipseJavaIDE I think it should be -1. As i will be 0 (i.e. false), the condition fails at first iteration itself and value of s will be as is.
English
0
0
0
0
Puneet Sapaliga പുനീത് സപലിഗ
@EclipseJavaIDE Compilation error - The type of the termination expression is an integer value. Expression should be constructed in such a way that it returns a Boolean value True/False. Upon executing this code an Exception will be generated which will indicate a compilation error.
English
1
0
0
0
Paylaş