exam questions

Exam 1z0-808 All Questions

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

Exam 1z0-808 topic 1 question 222 discussion

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

Given the code fragment:

Which action enables the code to print Helping`¦ Done?

  • A. replace class Humanoid extends Robot { with abstract class Humanoid extends Robot {
  • B. replace interface Speakable { with abstract class Speakable
  • C. replace public void process(); with public abstract void process();
  • D. replace abstract class Robot implements Speakable { with class Robot extends Speakable {
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
dsms
5 months, 2 weeks ago
Selected Answer: C
Correct answer is: C The answer lies on the surface - you just have to be careful. An abstract class method must either be abstract or have an implementation! In this case, we need to fix the syntax error - make the method abstract.
upvoted 2 times
...
akbiyik
1 year, 1 month ago
Selected Answer: C
Answer is C.
upvoted 1 times
...
carloswork
1 year, 3 months ago
Selected Answer: C
Tested, answer is C. To test: abstract class Robot implements Speakable { public void process(); // replace public void process(); with public abstract void process(); } class Humanoid extends Robot { public void speak(String s) { System.out.println(s); } public void process() { System.out.println("Helping... "); } } interface Speakable { public void speak(String s); } public class Test { public static void main(String[] args) { Robot r = new Humanoid(); r.process(); r.speak("Done"); } }
upvoted 1 times
...
iSnover
1 year, 3 months ago
Selected Answer: C
The correct answer is letter C, you can answer by elimination: A -> The humanoid class already overloads the 2 methods of its super class and the interface that implements its superclass, it wouldn't change anything to put abstract in the class definition B -> I wouldn't change anything either, even switching to an abstract class, its methods are overloaded D -> This is the most wrong one, a class cannot extend an interface, classes implement interfaces, the only type of object that can extend interfaces are the interfaces themselves.
upvoted 1 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