volume_mute
What is the result of print statement in this Java program (+=)?
publish date: 2020/09/05 02:29:00 GMT+10
volume_mutepublic class AssShortcutExample { public static void main(String args[]) { int num1 = 10; int num2 = 20; num2 += num1; System.out.println("= Output: "+num2);
}
}
Missing Word
Correct Answer
30
Explanation
num2 += num1 is a shortcut assignment operator to sum num2 and num1 and assign the result to num2
num2 = num2 + num1 ==> num2 = 20 + 10
num2 = 30