exam questions

Exam 1z0-809 All Questions

View all questions & answers for the 1z0-809 exam

Exam 1z0-809 topic 1 question 10 discussion

Actual exam question from Oracle's 1z0-809
Question #: 10
Topic #: 1
[All 1z0-809 Questions]

Given the content of Operator.java, EngineOperator.java, and Engine.java files:
and the code fragment:

What is the result?

  • A. The Engine.java file fails to compile.
  • B. The EngineOperator.java file fails to compile.
  • C. The Operator.java file fails to compile.
  • D. ON OFF
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
jduarte
Highly Voted 3 years, 9 months ago
answer is C becouse method is protected abstract void turnOn(); protected abstract void turnOFF();
upvoted 5 times
...
MPignaProTech
Most Recent 2 weeks, 3 days ago
Selected Answer: C
the abstract method in an abstract class must be declared abstract. Correct answer is C
upvoted 1 times
...
shivkumarx
9 months ago
Selected Answer: C
Abstract classes do not implicitly add abstract modifier Even if abstract modifier was added, the Engine class compiles fine and the code prints ON OFF
upvoted 1 times
...
asdfjhfgjuaDCV
9 months, 1 week ago
Answer is D.
upvoted 1 times
asdfjhfgjuaDCV
9 months ago
C is corrcet sorry for above
upvoted 1 times
...
...
steefaand
10 months, 1 week ago
Selected Answer: C
C is correct since methods are not declared abstract but dont have body.
upvoted 1 times
...
r1muka5
1 year, 9 months ago
Correct answer - C
upvoted 1 times
...
dexdinh91
2 years, 2 months ago
Selected Answer: C
methods do not have body in class Operator
upvoted 1 times
...
karta
2 years, 4 months ago
answer is C the Operator class turnON()& turnOFF() method need the body or change to abstract
upvoted 1 times
...
Tarik2190
3 years, 7 months ago
If we do not make changes to turnON() and turnOFF() methods, then Operator class will not compile. class abstract class Operator { protected void turnON(); protected void turnOFF(); } class EngineOperator extends Operator { public final void turnON() { System.out.println("ON"); } public final void turnOFF() { System.out.println("OFF"); } } class Engine { Operator m = new EngineOperator(); public void operate() { m.turnON(); m.turnOFF(); } } public class Test { public static void main(String[] args) { Engine carEngine = new Engine(); carEngine.operate(); } }
upvoted 2 times
...
Tarik2190
3 years, 7 months ago
Answer is C: There are 2 ways to print output as ON/OFF: 1) methods turnON() and turnOFF() need to be declared as abstract. or 2) methods turnON() and turnOFF() need to be declared as protected void turnON() {some code here...}. Only then, EngineOperator class will be able to override these methods.
upvoted 3 times
...
JME_CHG
3 years, 8 months ago
C but if corrected, then there are 2 possibilities: 1. if all classes in same package, then D. 2. if not in same package, then A.
upvoted 3 times
...
varconite
4 years ago
answer is C
upvoted 4 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago