Oracle
1Z0-851 · Question #254
Given: public class A { public void doit() { } public String doit() { return "a"; } public double doit(int x) { return 1.0; } } What is the result?
The correct answer is C. Compilation fails because of an error in line 4. See the full explanation below for the reasoning.
Question
Given: public class A { public void doit() { } public String doit() { return "a"; } public double doit(int x) { return 1.0; } } What is the result?
Options
- AAn exception is thrown at runtime.
- BCompilation fails because of an error in line 7.
- CCompilation fails because of an error in line 4.
- DCompilation succeeds and no runtime errors with class A occur.
How the community answered
(57 responses)- A9% (5)
- B5% (3)
- C70% (40)
- D16% (9)
Community Discussion
No community discussion yet for this question.