ERROR - The method of(int, Month, int, int, int) in the type LocalDateTime is not applicable for the arguments (int, String, int, int, int)

Error

The method of(int, Month, int, int, int) in the type LocalDateTime is not applicable for the arguments (int, String, int, int, int), while working with LocalDateTime and Java 8.

Error Type

Compile Time

Sample Code

LocalDateTime localDateTime = LocalDateTime.of(2015, "MARCH", 12, 12, 0);

Cause

LocalDateTime.of expects the month enum constant and not the String.

Resolution

Use Month Enum constant instead of String.

LocalDateTime localDateTime = LocalDateTime.of(2015, Month.MARCH, 12, 12, 0);