Which statements are true regarding the execution of the following code?
public class Main { public static void main(String[] args) { int j = 5;//from ww w . j av a 2 s.com for (int i = 0; i< j; i++) { assert i < j-- : i > 0; System.out.println(i * j); } } }
Select the two correct answers.
(c) and (d)
The variable j is only decremented if assertions are enabled.
The assertion never fails, since the loop condition ensures that the loop body is only executed as long as i<j is true.
With assertions enabled, each iteration decrements j by 1.
The last number printed is 20 if assertions are disabled at runtime, and the last number printed is 4 if assertions are enabled at runtime.