Java SE 8 Programmer II — Question 95

Given:
public class Counter {
public static void main (String[ ] args) {
int a = 10;
int b = -1;
assert (b >=1) : "Invalid Denominator";
int Ñ = a / b;
System.out.println (c);
}
}
What is the result of running the code with the ""da option?

Answer options

Correct answer: A

Explanation

The code will throw an AssertionError due to the assertion statement failing since b is -1, which is not greater than or equal to 1. Therefore, options B, C, and D are incorrect as they do not reflect the outcome of the assertion check.