Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Extending Classes With Final Variables Create a new class called PhoenixShip that extends Spaceship. Try to set the alliance class variable to Blue as follows:
Extending Classes With Final Variables Create a new class called PhoenixShip that extends Spaceship. Try to set the alliance class variable to "Blue" as follows: public static String alliance = "Blue"; That works! Why is that the case? Technically, this variable is PhoenixShip.alliance. The Spaceship.alliance variable has not changed. To demonstrate this, try adding this method. public static void changeSpaceshipAlliance() \{ Spaceship. alliance = "Blue"; Java will complain. So, when you are adding an alliance constant in the PhoenixShip class, the variable you are defining is: PhoenixShip.alliance. It's a different variable
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started