Question: You have defined the following enum constants: enum Seasons { Winter, Spring, Summer, Fall }; In the main method of the class Test, you have
You have defined the following enum constants:
enum Seasons { Winter, Spring, Summer, Fall };
In the main method of the class Test, you have coded
Seasons.Fall = Autumn; // line 10
When you compile, you get the following message:
Test.java:10: error: cannot assign a value to final variable Fall Seasons.Fall = Autumn; // line 10 ^ Test.java:10: cannot find symbol Seasons.Fall = Autumn; // line 10 ^ symbol : variable Autumn location: class Test 2 errors
Explain what the problem is and how to fix it.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
