ExamQuestions.com

Register
Login
Java SE 8 Programmer II Exam Questions

Oracle

Java SE 8 Programmer II

1 / 130

Question 1:

Given the definition of the Vehicle class: Class Vehicle { int distance; Vehicle (int x) { this distance = x; } public void increSpeed(int time){ int timeTravel = time;//line n1 //line n3 class Car { int value = 0; public void speed () { value = distance /timeTravel; //line n2 System.out.println ("Velocity with new speed"+value+"kmph"); } } speed();//line n3 } } and this code fragment: Vehicle v = new Vehicle (100); v.increSpeed(60); What is the result? 

Answer options:

A. Velocity with new speed 1 kmph
B. A compilation error occurs at line n1.
C. A compilation error occurs at line n2.
D. A compilation error occurs at line n3.