Author Archives: MasterJavaTutorial

Practice Problems on enum – Set2

Will the below code of enum compile?? package com.masterjavatutorial; public enum MONTHS { public void methodOne(){ System.out.println(“Method One”); } } Semicolon is mandatory if any method is declared in… Read more »

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 »