Print day of week using Gregorian Calendar in java
Given a date, you have to print the day of the week.
Input : 2018 3 26 Output : Mon Input : 2010 8 9 Output : Wed
The idea is to use java built-in API Gregorian Calendar.
GregorianCalendar is a concrete subclass of Calendar and provides
the standard calendar system used by most of the world.
GregorianCalendar(int year, int month, int dayOfMonth) constructs a
GregorianCalendar with the given date set in the default time zone
with the default locale.
Several conditions are created to check the validity of
the input data. If an input is found to be wrong an Invalid
message will be printed as output.
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.