Java
Programming and Technical
Programming
Program
public class Test
{
public static void main(String[] args)
{
int x = 0;
assert (x > 0) : "assertion failed"; /* Line 6 */
System.out.println("finished");
}
}
A. finished
B. Compilation fails.
C. An AssertionError is thrown.
D. An AssertionError is thrown and finished is output.
Read Solution (Total 3)
-
- A
If we add assert statement then the boolean condition is get checked at runtime
if condition fails then it will throw an assertion error - 7 years agoHelpfull: Yes(1) No(0)
- A.finished
- 7 years agoHelpfull: Yes(0) No(0)
- A. finished
- 3 years agoHelpfull: Yes(0) No(0)
Java Other Question