+ 1

Can someone please tell me why is the output of the code is error?

{ boolean b="true"; int i=1; if (b) { i++; } System.out.print(i); }

18th Apr 2017, 6:10 AM
Aniket Singh
3 Respuestas
+ 21
boolean b = true; Erase the double quotes.
18th Apr 2017, 6:22 AM
Shamima Yasmin
Shamima Yasmin - avatar
+ 2
Because you try to use a string value "true" in boolean variable. Try b=true instead of b="true".
18th Apr 2017, 6:22 AM
Jeth
Jeth - avatar
0
tnx..
18th Apr 2017, 6:26 AM
Aniket Singh