Online Java Compiler By
JavaTpoint.com
import java.time.*; public class MonthEnumExample2 { public static void main(String[] args) { Month month = Month.from(LocalDate.now()); System.out.println(month.getValue()); System.out.println(month.name()); } }
Output