Hi guys,
I made the method workable, and it outputs precisely what it should, but the Judge doesn't accept my solution.
My assumption is this is because of
try-catch
block, so fine, but can anyone give me a hint on what should I focus on to resolve it correctly?
Thank you in advance!package en.codegym.task.pro.task16.task1601;
import com.sun.source.tree.TryTree;
import java.time.DateTimeException;
import java.time.DayOfWeek;
import java.util.Date;
/*
Just not on Monday :)
*/
public class Solution {
static Date birthDate = new Date(86, 02, 10);
public static void main(String[] args) {
System.out.println(getDayOfWeek(birthDate));
}
static String getDayOfWeek(Date date) {
int day = date.getDay();
try {
DayOfWeek dayOfWeek = DayOfWeek.of(day);
return String.valueOf(dayOfWeek);
}
catch (DateTimeException e){
}
return "SUNDAY";
}
}