Home / Expert Answers / Computer Science / what-is-the-output-result-if-class-gala-is-changed-to-the-following-public-class-gala-extends-pa777

(Solved): What is the output result if class Gala is changed to the following? ``` public class Gala extends ...



What is the output result if class Gala is changed to the following? ``` public class Gala extends Apple{ public Gala (int p){ price = super.price + p; weight = p; } public static void main(String[] args){ Gala g1 = new Gala(10); System.out.println(g1.price+", "+Gala.weight); } } ``` ``` public class Fruit{ int price = 5; static int weight = 1; public Fruit(){ System.out.printIn ("Fruit"); } } public class Apple extends Fruit{ public Apple(){ System.out.printIn("Apple"); } } ``` ``` public class Gala extends Apple{ public Gala (int p){ price = p; System.out.printIn("Gala"); } public static void main(String[] args){ Gala g1 = new Gala(10); Gala g2 = new Gala(15); System.out.println(g1.price); System.out.println(g2.price); g1.weight = 2; System.out.println(g2.weight); } } ```



We have an Answer from Expert

View Expert Answer

Expert Answer


We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe