Oracle
1Z0-809 · Question #80
1Z0-809 Question #80: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-809 to reveal the answer and full explanation for question #80. The question stem and answer options stay visible for context.
Question
Given the definition of the Vehicle class:
class Vehicle {
int distance;//line n1
Vehicle (int x) {
this.distance = x;
}
}
public void increSpeed(int time) {//line n2
int timeTravel = time;//line n3
class Car {
int value = 0;
public void speed () {
value = distance /timeTravel;
System.out.println ("Velocity with new speed"+value+"kmph");
}
}
new Car().speed();
}
and this code fragment:
Vehicle v = new Vehicle (100);
v.increSpeed(60);
What is the result?
Options
- AVelocity with new speed 1 kmph
- BA compilation error occurs at line n1.
- CA compilation error occurs at line n2.
- DA compilation error occurs at line n3.
Unlock 1Z0-809 to see the answer
You've previewed enough free 1Z0-809 questions. Unlock 1Z0-809 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.