Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4607958
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T00:46:35+00:00 2026-05-22T00:46:35+00:00

I am clear with advanced use of enum in java. Many of the points

  • 0

I am clear with advanced use of enum in java. Many of the points which differentiate them from regular classes and tells their need are also clear to me.

Can anyone give some practical example with sample code for advanced enum? Which can clearly elaborate about

where we should avoid classes and
should use enum instead

.

Please dont be confused. I am not asking for how to use enum or what is the use of enum. There are many questions and answers on this. I am looking for some real time/ live / practical example where we should avoid any other data type or classes.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T00:46:36+00:00Added an answer on May 22, 2026 at 12:46 am

    Try this example:

    public enum Day {
        SUNDAY, MONDAY, TUESDAY, WEDNESDAY, 
        THURSDAY, FRIDAY, SATURDAY 
    }
    

    Usage:

    public class EnumTest {
        Day day;
    
        public EnumTest(Day day) {
            this.day = day;
        }
    
        public void tellItLikeItIs() {
            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) {
            EnumTest firstDay = new EnumTest(Day.MONDAY);
            firstDay.tellItLikeItIs();
            EnumTest thirdDay = new EnumTest(Day.WEDNESDAY);
            thirdDay.tellItLikeItIs();
            EnumTest fifthDay = new EnumTest(Day.FRIDAY);
            fifthDay.tellItLikeItIs();          
    
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm not advanced linux user. I use ubuntu. When I start any process from
Pretty clear from the title itself, what is meant by porting an application X
I'm still not clear on how and when to use interface builder. I have
Is there a way to use cin.clear() or cin,ignore() for ONLY the previous line
I've encountered a problem while trying to use the answer from a NDSolve in
I have an IIS-hosted WCF service which is configured to use basicHttpBinding with transport
I have a data template that I use in many pages, the data template
Ok Title may not be clear so let me explain. I have 2 classes,
I want to compare an string which is in clear text in the database
I was looking for a reliable, clean way to do advanced runtime reports for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.