Given:
01. Float pi = new Float(3.14f);
02. if (pi > 3) {
03. System.out.print(“pi is bigger than 3. “);
04. }
05. else {
06. System.out.print(“pi is not bigger than 3. “);
07. }
08. finally {
09. System.out.println(“Have a nice day.”);
10. }
What is the result?
A.
Compilation fails.
B.
pi is bigger than 3.
C.
An exception occurs at runtime.
D.
pi is bigger than 3. Have a nice day.
E.
pi is not bigger than 3. Have a nice day.
Explanation:
Main.java:08: ‘finally’ without ‘try’
finally {
^
1 error