PGoCareerGoCareer prep tools
Home
LoginSign up
  • Java
  • Python
  • AI
  • React
  • Angular
  • PHP
  • Node.js
  • SQL
  • DSA
  • HTML
  • CSS
  • JS
  • Spring
  • ML
  • MongoDB

Java · Theory

Java Enums

← All stacks

Theory

65/270

Java Enums

enum defines a fixed set of named constants. Safer than int/string flags.

Can have fields and methods.

Compare with == for enum constants.

Write one tiny example for Enums. Compile, print one result, and say the output out loud before you type.

Use Enums only when the problem needs it. Don’t force it into every program. Know one beginner trap.

Let's take this on the board with one tiny Main class — no extra files. Java Enums — prints MON and true — enums are typed constants. Start from main, go line by line, and stop at each print. That output is the proof for Enums.

Exam tip

Show Day.MONDAY style usage in one line.

Example

enum Day { MON, TUE, WED }
public class Main {
  public static void main(String[] args) {
    Day d = Day.MON;
    System.out.println(d);
    System.out.println(d == Day.MON);
  }
}

Java Enums — prints MON and true — enums are typed constants.

Short notes

  • DefEnums is a Java idea you should explain with one small example.
  • RuleKnow the keyword / API used for Enums. Type a tiny Main and print one result.
  • RememberFor Enums, say the output before you code.
  • TrapEnums — only memorising the heading. No example, no trap.
  • Fixed constants
  • Type-safe

Questions

1

What is Enums?

2

Why do we use Enums in Java?

3

Write one small example of Enums.

4

What mistake do beginners make with Enums?

5

Where is Enums used in a real program?

Previous← Call by Value and Call by Reference in JavaNextCommand Line Arguments in Java →
P

GoCareerGo

Utilities · Preparation Hub · Resume · CV · Tools — one workspace.

Workspace

DashboardProfilePreparation HubResume builderCV builderCareer planning

PDF Tools

Merge PDFSplit PDFCompress PDFImage to PDFAll toolsJobs

Image & QR

Compress ImageResize ImageQR ScannerQR GeneratorBlogIT interview prep

Company

FAQFeedbackContactPrivacyTermsSitemap

© 2026 GoCareerGo. Keep moving forward.