Java Program to Create a Simple Enum

You are currently viewing Java Program to Create a Simple Enum

Java program to create a simple enum

// Java program to create a simple enum

enum Vehicle {
  BIKE,
  CAR,
  BUS
}

public class Main {
  public static void main(String[] args) {
    Vehicle car = Vehicle.CAR;
    System.out.println("Vehicle is: " + car);
  }
}

Output

Vehicle is: CAR

Ranjith

Hi, I'm Manoj a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Diksha. Here, I post about programming to help developers.

Leave a Reply