You are viewing a single comment's thread. Return to all comments →
import java.util.*;
public class Solution {
public static String findDay(int month, int day, int year) { Calendar calendar = Calendar.getInstance(); calendar.set(year, month - 1, day); // Month is 0-based in Calendar String[] days = { "SUNDAY", "MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY" }; int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK); return days[dayOfWeek - 1]; } public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int month = scanner.nextInt(); int day = scanner.nextInt(); int year = scanner.nextInt(); scanner.close(); String result = findDay(month, day, year); System.out.println(result); }
}
Seems like cookies are disabled on this browser, please enable them to open this website
Java Date and Time
You are viewing a single comment's thread. Return to all comments →
import java.util.*;
public class Solution {
}