nerdexam
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)
  • A
    9% (5)
  • B
    5% (3)
  • C
    70% (40)
  • D
    16% (9)

Community Discussion

No community discussion yet for this question.

Full 1Z0-851 Practice