Question: Assume that we have defined an enum type Planet and an instance memberMethod() , both in class SolarSystem : class SolarSystem { public enum Planet

Assume that we have defined an enum type Planet and an instance memberMethod(), both in class SolarSystem:

class SolarSystem { public enum Planet { MERCURY, VENUS, EARTH, MARS, JUPITER, SATURN, URANUS, NEPTUNE } void memberMethod() { ... } } 

Also assume, as usual, that, a totally separate and unrelated class, Foothill, contains the client main().

Which statements have enum-related compiler errors? Assume that these are isolated statements in otherwise sensible, error-free programs and that there are no variables with the names MERCURY,... NEPTUNE anywhere in our program other than the ones seen above.

(There may be more than one correct choice.)

 public void memberMethod() { Planet myHome = Planet.NEPTUNE; }
 public static void main(String[] args) { Planet myHome; myHome = Planet.VENUS; }
 public static void main(String[] args) { SolarSystem.Planet myHome; myHome = SolarSystem.Planet.VENUS; }
 public static void main(String[] args) { SolarSystem sol = new SolarSystem(); sol.memberMethod(); }
 public void memberMethod() { Planet myHome = EARTH; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!