Create New Enum in Eclipse

Enum has fixed set of constants, which improves type safety. It is a datatype consisting of a set of named values. Let’s see how to create new Enum in Eclipse.

Launch Eclipse and click the File menu,

File > New > Enum

Reach Eclipse New Enum section

After clicking Enum above, a new dialog box will open. This section provides you with options to create new Enum.

Create new Enum in Eclipse

The following options are provided while creating Enum in Eclipse.

Source Folder
Mention the source folder for the enum or click Browse to select a source folder via a dialog.

Package
Mention the package here, in which the new enumgets added. Go for this option or select the Enclosing Type option.

Enclosing type
Select a type here, to enclose the new enum. Select this or the Package option above.

Name
You need to type the name of the new enum here.

Modifiers
Select modifiers: public, private, protected. You need to select one or more access modifiers for the new enum.

Interfaces
Choose interfaces by clicking Add, which the new interface extends.

Do you want to add comments?
Select the option, if you want the comments to be added to the new class.

Create New Java Interface in Eclipse
Run First Program in Eclipse
Studyopedia Editorial Staff
Studyopedia Editorial Staff
[email protected]

We work to create programming tutorials for all.

1 Comment
  • David Cone
    Posted at 02:13h, 04 June Reply

    What are valid enclosing types? I’m trying to make an enum of integers.

Post A Comment

Discover more from Studyopedia

Subscribe now to keep reading and get access to the full archive.

Continue reading