Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.)

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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Spatial Databases 2nd Symposium Ssd 91 Zurich Switzerland August 1991 Proceedings Lncs 525

Authors: Oliver Gunther ,Hans-Jorg Schek

1st Edition

3540544143, 978-3540544142

More Books

Students also viewed these Databases questions

Question

What are negative messages? (Objective 1)

Answered: 1 week ago