Write the code that will declare a variable named \'myApple\' of class Apple. //
ID: 3864928 • Letter: W
Question
Write the code that will declare a variable named 'myApple' of class Apple.
//using this code
public class Fruit {
private double pricePerPound;
private String code;
public Fruit(double pricePerPound, String code) {
this.pricePerPound = pricePerPound;
this.code = code;
}
public Fruit(String code) {
this.code = code;
}
}
public class Apple extends Fruit {
private String variety;
public Apple(double pricePerPound, String code, String variety) {
}
public Apple(String code) {
}
}
//the code should be in java
Explanation / Answer
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.