What is displayed on the console when running the following program?

```
public class Test {
public static void main(String[] args) {
try {
System.out.println("Welcome to Java");
int i = 0;
int y = 2/i;
System.out.println("Welcome to Java");
}
finally {
System.out.println("End of the block");
}

System.out.println("End of the block");
}
}```
a. The program displays Welcome to Java three times followed by End of the block.
b. The program displays Welcome to Java two times followed by End of the block.
c. The program displays Welcome to Java two times followed by End of the block two times.
d. The program displays Welcome to Java and End of the block, and then terminates because of an unhandled exception.

d

Computer Science & Information Technology

You might also like to view...

Text filters allow you to create a custom filter to match all of the text in a field that you specify

Indicate whether the statement is true or false

Computer Science & Information Technology

What happens if the loop-continuation test is omitted in a for-statement?

a) C assumes the condition is false, so the loop terminates. b) A syntax error occurs. c) C assumes the condition is true, so the loop executes one more time, then terminates. d) An infinite loop.

Computer Science & Information Technology