Java SE 8 Programmer 1Z0–808 Practice Full Test 1
© examsiri.com
Question : 30 of 84
Marks:
+1,
-0
Given
And given the code fragment:
What is the result?
class Vehicle {
int x;
Vehicle() {
this(10); // line n1
}
Vehicle(int x) {
this.x = x;
}
}
class Car extends Vehicle {
int y;
Car() {
super();
this(20); // line n2
}
Car(int y) {
this.y = y;
}
public String toString()
{
return super.x + ":" + this.y;
}
}
And given the code fragment:
Vehicle y = new Car(); System.out.println (y) ;What is the result?
Go to Question: