Essay
public class EnumExample
{
enum Day {SUNDAY, MONDAY, TUESDAY, WEDNESDAY,
THURSDAY, FRIDAY, SATURDAY };
Day day;
public EnumExample(Day day)
{
this.day = day;
}
public void giveFeedback()
{
switch (day)
{
case MONDAY:
System.out.println("Mondays are bad.");
break;
case FRIDAY:
System.out.println("Fridays are better.");
break;
case SATURDAY: case SUNDAY:
System.out.println("Weekends are best.");
break;
default:
System.out.println("Midweek days are so-so.");
break;
}
}
public static void main(String[] args)
{
EnumExample firstDay = new EnumExample(Day.MONDAY);
firstDay.giveFeedback();
EnumExample thirdDay = new EnumExample(Day.WEDNESDAY);
thirdDay.giveFeedback();
EnumExample fifthDay = new EnumExample(Day.FRIDAY);
fifthDay.giveFeedback();
EnumExample sixthDay = new EnumExample(Day.SATURDAY);
sixthDay.giveFeedback();
EnumExample seventhDay = new EnumExample(Day.SUNDAY);
seventhDay.giveFeedback();
}
}
Using the above enumeration and code, what will be the output when the program is executed?
Correct Answer:

Verified
Mondays are bad.
Midweek days...View Answer
Unlock this answer now
Get Access to more Verified Answers free of charge
Correct Answer:
Verified
Midweek days...
View Answer
Unlock this answer now
Get Access to more Verified Answers free of charge
Q49: Using the ArrayList add() method, write the
Q50: Match each term with the correct statement
Q51: You can think of the single dimension
Q52: The simplest possible sort involves two values
Q53: import java.util.*; <br>public class sortArray <br>{ <br>
Q55: The Arrays class _ methods are a
Q56: Match each term with the correct statement
Q57: int[][] myVals = {{2, 4, 6}, {1,
Q58: Describe how to visualize the following array.
Q59: Match each term with the correct statement