0
How its result 17? can anyone explain
What is the output of this code? int result = 0; for (int i = 0; i < 5; i++) { if (i == 3) { result += 10; } else { result += i; } } System.out.println(result); //Output : 17 actually i don't understand " result+=" this section;
1 Odpowiedź
+ 2
+= its an operator that add the current value + the new one.
result = result + i;
or
result+=i;
both codes do the same.