Oracle
1Z0-851 · Question #76
Given: 01. public class Blip { 02. protected int blipvert(int x) { return 0; } 03. } 04. class Vert extends Blip { 05. // insert code here 06. } Which five methods, inserted independently at line 5…
The correct answer is A. public int blipvert(int x) { return 0; } C. private int blipvert(long x) { return 0; } E. protected int blipvert(long x) { return 0; } F. protected long blipvert(long x) { return 0; } G. protected long blipvert(int x, int y) { return 0; }. private int blipvert(int x) { return 0; } - Cannot reduce the visibility of the inherited method from Blip protected long blipvert(int x) { return 0; } - The return type is incompatible with Blip.
Analyzing and Troubleshooting System Problems
Question
Given: 01. public class Blip { 02. protected int blipvert(int x) { return 0; } 03. } 04. class Vert extends Blip { 05. // insert code here 06. } Which five methods, inserted independently at line 5, will compile? (Choose five.)
Options
- Apublic int blipvert(int x) { return 0; }
- Bprivate int blipvert(int x) { return 0; }
- Cprivate int blipvert(long x) { return 0; }
- Dprotected long blipvert(int x) { return 0; }
- Eprotected int blipvert(long x) { return 0; }
- Fprotected long blipvert(long x) { return 0; }
- Gprotected long blipvert(int x, int y) { return 0; }
How the community answered
(31 responses)- A81% (25)
- B13% (4)
- D6% (2)
Explanation
private int blipvert(int x) { return 0; } - Cannot reduce the visibility of the inherited method from Blip protected long blipvert(int x) { return 0; } - The return type is incompatible with Blip.
Topics
#Java method overriding#access modifiers#return type#overloading
Community Discussion
No community discussion yet for this question.