What is the result?
A.
Compilation succeeds.
B.
Compilation fails due to an error on line 1.
C.
Compilation fails due to an error on line 2.
D.
Compilation fails due to an error on line 3.
E.
Compilation fails due to an error on line 4.
F.
Compilation fails due to an error on line 8.
Explanation:
Not correct, the following compilation error appeared to me ::
Illegal modifier for the constructor in type FinalShow; only public, protected & private are permitted
in Line 6 and Line 3
Answer is D
A is the correct answer. No compile errors.
FinalShow.java:
final class FinalShow {
final String location;
FinalShow(String loc) {
location = loc;
}
FinalShow(String loc, String title) {
location = loc;
loc = “unknown”;
}
}
A >> no compile errors.
A, no errors! confirmed java 7 compiler
+1
A. Compilation succeeds
Answer is A