logo image

Java program to print present month



Following program shows you how to print present month. We can get present month using LocalDate.now().getMonth() in java.

import java.time.LocalDate;
import java.time.Month;

public class Basic15 {

	public static void main(String[] args) {

		LocalDate presentDate = LocalDate.now();
		Month currentMonth = presentDate.getMonth();

		System.out.println("Present Month is: " + currentMonth);
	}

}

Output:

Present Month is: MARCH