Hi
The question is as follows.
Given the following,
1.public class TestObj {
2. public static void main (
String [] args) {
3. Object o = new Object() {
4. public boolean equals(Object obj) {
5. return true;
6. }
7. }
8. System.out.println(o.equals("Fred"));
9. }
10.}
what is the result?
A. An exception occurs at runtime.
B. true
C. fred
D. Compilation fails because of an error on line 3.
E. Compilation fails because of an error on line 4.
F. Compilation fails because of an error on line 8.
G. Compilation fails because of an error on a line other than 3, 4, or 8.
Correct answer is specified as G.
I felt the correct answer was None of the above because there is a missing semi colon at the end of the inner class definition which is line 7.
Please confirm.