You are viewing a single comment's thread. Return to all comments →
Another problem written by people who either don't undestand the api or are deliberately trying to mislead in a supposedly easy one.
easy
Kindly note that month starts with 0 (not 1) and scanner.nextInt() can be directly used.
public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); int month = in.nextInt(); int day = in.nextInt(); int year = in.nextInt(); Calendar cal = new GregorianCalendar(Locale.US); cal.set(year, month-1, day); System.out.println(cal.getDisplayName(GregorianCalendar.DAY_OF_WEEK, Calendar.LONG, Locale.US).toUpperCase()); } }
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 →
Another problem written by people who either don't undestand the api or are deliberately trying to mislead in a supposedly
easy
one.Kindly note that month starts with 0 (not 1) and scanner.nextInt() can be directly used.