Given the following code, which statement is true? class Water() { ... } class Juice() extends Water { class Apple() { ... } class ApplePie() { Apple al = new Apple(); } class AppleJuice() { Apple al = new Apple(); Water wl = new Water(); } } ... ApplePie is a composite class that contains an instance of Apple class. Juice is a superclass and Water is a subclass. ApplePie is a superclas of Apple. AppleJuice is a superclass that contains an instance of Apple class and an instance of Water. Water is a composite class that contains an instance of Juice.

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter10: Introduction To Inheritance
Section: Chapter Questions
Problem 20RQ
icon
Related questions
Question

Java Questions - Based on the code, which answer out of the choices "1, 2, 3, 4, 5" is correct. Explanation is not needed, just please make sure that the answer you have chosen is the correct option. Thanks. Question is in attached picture. 

Given the following code, which statement is true?
class Water() { ... }
class Juice() extends Water {
class Apple() { ... }
class ApplePie() { Apple al = new Apple(); }
class AppleJuice() { Apple al = new Apple(); Water wl = new Water(); }
}
...
ApplePie is a composite class that contains an instance of Apple class.
Juice is a superclass and Water is a subclass.
ApplePie is a superclas of Apple.
AppleJuice is a superclass that contains an instance of Apple class and an instance of
Water.
Water is a composite class that contains an instance of Juice.
Transcribed Image Text:Given the following code, which statement is true? class Water() { ... } class Juice() extends Water { class Apple() { ... } class ApplePie() { Apple al = new Apple(); } class AppleJuice() { Apple al = new Apple(); Water wl = new Water(); } } ... ApplePie is a composite class that contains an instance of Apple class. Juice is a superclass and Water is a subclass. ApplePie is a superclas of Apple. AppleJuice is a superclass that contains an instance of Apple class and an instance of Water. Water is a composite class that contains an instance of Juice.
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT