Oracle
1Z0-819 · Question #29
1Z0-819 Question #29: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-819 to reveal the answer and full explanation for question #29. The question stem and answer options stay visible for context.
Question
Given:
Automobile.java
public abstract class Automobile { //line 1
abstract void wheels();
}
Car.java
public class Car extends Automobile {
void wheels(int i) { // line 2
System.out.print(4); // line 3
}
}
public static void main(String[] args) {
Automobile cb = new Car(); // line 4
cb.wheels();
}
What must you do so that the code prints 4?
Options
- ARemove the parameter from wheels method in line 3.
- BAdd @Override annotation in line 2.
- CChange the instantiation of line 4 to Car cb = new Car();
- DRemove abstract keyword in line 1.
Unlock 1Z0-819 to see the answer
You've previewed enough free 1Z0-819 questions. Unlock 1Z0-819 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.