What will be the output of the following program?

public class Test {
    public static void main(String[] args) {
        int num = 10;
        assert (num < 5) ? "Assertion failed" : "Assertion passed";
        System.out.println("Program executed successfully");
    }
}

1
Program executed successfully
2
Compilation fails
3
An AssertionError is thrown, and "Program executed successfully" is output
4
An AssertionError is thrown with the message "Assertion failed"
5
Question Not Attempted

Sponsored

hivanix.in

Visit

This quiz is brought to you by hivanix.in

🌐 Web App Development

Quick Navigation