1 2 3 4 5 6 7 8 9 10 11 12
class Food { Food() { System.out.println("bland"); } } class Pepper extends Food { Pepper() { this("spicy"); } Pepper(String flavor) { System.out.println(flavor); } } public class Lunch { public static void main(String[] args) { Food lunch = new Pepper(); } }
Select One:
Add a comment:
If you enter anything in this field your review will be treated as spam: