logo

Crowdly

On antud 3 klassi: public class Fruit { int price = 10; pub...

✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.

On antud 3 klassi:

public class Fruit {

int price = 10;

public int getPrice() {

return price;

}

}

public class Apple extends Fruit {

@Override

public int getPrice() {

return super.getPrice() * 3 + super.getPrice();

}

}

public class Main {

public static void main(String[] args) {

Fruit fruit = new Fruit();

Apple firstApple = new Apple();

Apple secondApple = new Apple();

System.out.println(fruit.getPrice() + firstApple.getPrice() + secondApple.getPrice());

}

}

Mis on programmi väljund?

0%
More questions like this

Want instant access to all verified answers on moodle.taltech.ee?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!