enum in switch statement

enum concept was introduced in java 1.5 . from 1.5 version in Java, switch statements were allowed to use enums. MONTHS.java package com.masterjavatutorial; public enum MONTHS { JAN,FEB,MAR,APR,MAY; } Test.java… Read more »

toString() in enum

Default implementation of toString() method lies in Object class. Object is the super class of all classes. If a class does not override toString() method, then Object class toString() method… Read more »

Rules for Syntax of enum

enum concept was introduced in java 1.5. enum is used to represent a group of constants. A Simple enum class can be declared as below: package com.masterjavatutorial; public enum MONTHS… Read more »

Main() Method in enum

enum can have public static void main() method . main() method in enum executes just like its execution in any other class. The below example explains the main method in… Read more »