12th Mar 2018, 2:43 PM
Arushi Singhania
Arushi Singhania - avatar
8 odpowiedzi
+ 8
@Geo, it's not my code. I just found it in a java challange and i was not able to understand its output. That's why I ask.
12th Mar 2018, 3:15 PM
Arushi Singhania
Arushi Singhania - avatar
+ 6
thanks
12th Mar 2018, 3:02 PM
Arushi Singhania
Arushi Singhania - avatar
+ 5
Normaly you have to use break in you case to exit the switch : switch (a){ case 1 : ++x; break; case 2: ++x; break; case 3: ++x; break; default : ++x; }
12th Mar 2018, 3:11 PM
Geo
Geo - avatar
+ 4
@Geo, it's not my code. I just found it in a java challange and i was not able to understand its output. That's why I ask.
12th Mar 2018, 3:15 PM
Arushi Singhania
Arushi Singhania - avatar
+ 4
@Arushi Ok, no problem ☺
12th Mar 2018, 3:20 PM
Geo
Geo - avatar
+ 3
I don't understand why it's giving o/p as 3! Actual o/p should be 1
12th Mar 2018, 3:10 PM
Bread_winner
Bread_winner - avatar
+ 2
@菜々子林 oh yeah mate!
12th Mar 2018, 4:18 PM
Bread_winner
Bread_winner - avatar
+ 1
the x value will be increase by incremental and the value in case of 2
12th Mar 2018, 3:03 PM
Muhammad Hasnain
Muhammad Hasnain - avatar