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 7993779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T13:57:14+00:00 2026-06-04T13:57:14+00:00

Correct me if I’m wrong: enum is a type an object of some enum

  • 0

Correct me if I’m wrong:

  1. enum is a type
  2. an object of some enum type can take 1 and only 1 enum value at a time

Now I’ve got a question:
Assume I’ve defined an enum(or some other data structure that’s suitable for the task; I can’t name it, because I’m looking for such a data structure to accomplish the following task) somewhere in my java program. If, somehow, I have an enum(or some other data structure) object in main(String []) and I want it to take multiple values of the enum(or some other data structure), how do I do it? What’s the suitable data structure I should use if it’s not enum?

Thanks in advance!

  • 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-06-04T13:57:15+00:00Added an answer on June 4, 2026 at 1:57 pm

    You could use a simple array, any collection from the core java.util API would also do the job (like lists or sets, it’s a bit more convenient than using arrays), but probably what you are after is EnumSet:

    enum Monster {
        GOBLIN, ORC, OGRE;
    }
    
    public class Main {
        public static void main(final String[] args) {
            final EnumSet<Monster> bigGuys = EnumSet.of(Monster.ORC, Monster.OGRE);
    
            for (final Monster act : Monster.values()) {
                System.out.println(bigGuys.contains(act));
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Correct me if anything is wrong. Now when we use Spring DAO for ORM
Please correct me if I am wrong. I am asking this question to clarify
(Correct me if I'm wrong.) A server host can detect the pages that a
Correct me if I'm wrong, the only way to have unbuffered (doesn't output to
correct me if i'm wrong, but Adobe AIR currently only allows applications to have
Correct me if I'm wrong please: Sessions will last a finite amount of time
correct me if im wrong, but isn't distributed SCMs for OS projects while centralized
Correct me If Im wrong. public class Person{ List<Cars> myCars; //Get and Set }
Correct me if I am wrong, but this SQL command: create table MYTABLE (ID
Correct me if I'm wrong - I understand a C#/.NET application's .csproj project file

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.