Given the content of three files: Which statement is true?
A.
The A.Java and B.java files compile successfully.
B.
The B.java and C.java files compile successfully.
C.
The A.Java and C.java files compile successfully.
D.
Only the B.java file compiles successfully.
E.
Only the A.Java file compiles successfully.
F.
Only the C.java file compiles successfully.
e
its c
C is the Right answer
Correct Answer is E. Only A compiles successfully.
Access Modifier is not allowed on a local variable in Class B.
Rule for Local Variable
– Local variables cannot use any of the access level since its scope is only inside the method.
– Final is the Only Non Access Modifier that can be applied to a local variable.
– Local variables are not assigned a default value, hence they need to be initialised.
Class C has statements in the wrong order…Correct order is Package,Import and Class (PIC).
Yes, option E is correct answer. thanks for detailed explanation.
thnx bro 🙂
Answer: E
Only the A.Java file compiles successfully.
Tested
e
??
c