23
Answer (Choose 1 answer)
A. (null.5.5)(Hoa,20,10)
B. (null,0.5)(Hoa. 20,10)
C. Compilation fails.
D. (null.5.0)(Hoa, 20,10)
class Vase {
What is the result of running the program below?
String color; int price;Vase() { price = 5; }
Vase(String color, int price) {
this.color-color; this.price price;
}
public String toString() {return(color+","+price);}
} class SpecVase extends Vase {
int type;
SpecVase() {type=5;}
SpecVase(String color, int price, int type) {
this.type=type;
super(color,price);
} void display() {
String s = "("+super.toString()+","+type+") ";
System.out.println(s);
}
} public class Main {
public static void main(String[] args) {
SpecVase x = new SpecVase();
SpecVase y = new SpecVase("Hoa",20, 10);
x.display(); y.display();System.out.println();
}