Given the definition of the Vehicle class:
Class Vehhicle {
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?
Correct Answer:
A
Given:
class Student {
String course, name, city;
public Student (String name, String course, String city) { this.course = course; this.name = name; this.city = city;
}
public String toString() {
return course + “:” + name + “:” + city;
}
and the code fragment: List
new Student (“Jessy”, “Java ME”, “Chicago”), new Student (“Helen”, “Java EE”, “Houston”), new Student (“Mark”, “Java ME”, “Chicago”)); stds.stream()
.collect(Collectors.groupingBy(Student::getCourse))
.f orEach(src, res) -> System.out.println(scr)); What is the result?
Correct Answer:
B
Given the content:
< ><>>< ><>
Correct Answer:
B
Given:
< ><>>< ><>
Correct Answer:
C
Given:
public class Canvas implements Drawable { public void draw () { }
}
public abstract class Board extends Canvas { }
public class Paper extends Canvas { protected void draw (int color) { }
}
public class Frame extends Canvas implements Drawable { public void resize () { }
}
public interface Drawable { public abstract void draw ();
}
Which statement is true?
Correct Answer:
E