Author Archives: MasterJavaTutorial

Enum valueOf() Method

valueOf() is a static method of java.lang.Enum which takes argument as String. valueOf() method returns the enum constant for the specified string value which is passed as an argument in… Read more »

values() method of Enum

All enums implicitly inherit java.lang.Enum class. values() is a static method of java.lang.Enum class. Hence, values() method is available in enum classes. values() method gives an array of enum class… Read more »

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. package com.masterjavatutorial; public enum MONTHS { JAN,FEB,MAR,APR,MAY; }… 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 »