Question: Which statements about the following program are true? Select the three correct answers: (a) The code will fail to compile. (b) The code defines a

Which statements about the following program are true?

public interface HeavenlyBody { String describe(); } class Star { } String

Select the three correct answers:

(a) The code will fail to compile.

(b) The code defines a Planet is-a Star relationship.

(c) The code will fail to compile if the name starName is replaced with the name bodyName throughout the declaration of the Star class.

(d) The code will fail to compile if the name starName is replaced with the name name throughout the declaration of the Star class.

(e) An instance of Planet is a valid instance of HeavenlyBody.

(f) The code defines a Planet has-a Star relationship.

public interface HeavenlyBody { String describe(); } class Star { } String starName; public String describe () { return "star + starName; } } class Planet extends Star ( String name; public String describe () { return "planet " + name + orbiting star } " "1 "1 + starName;

Step by Step Solution

3.40 Rating (153 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

b c and d The code as it stands will compile The use of inheritance in this ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Java Programming 8th Questions!