Search This Blog
Tuesday, March 23, 2021
Hackerrank Quetions- java
Q. Output the correct day in capital letters.
Sample Input
08 05 2015
Sample Output
WEDNESDAY
------------------------------------------------------
import java.time.LocalDate;
class Result {
    /*
     * Complete the 'findDay' function below.
     *
     * The function is expected to return a STRING.
     * The function accepts following parameters:
     *  1. INTEGER month
     *  2. INTEGER day
     *  3. INTEGER year
     */
    public static String findDay(int month, int day, int year) {
     return LocalDate.of(year, month, day).getDayOfWeek().name();
    }
}
----------------------------------------------------------------------
Subscribe to:
Post Comments (Atom)
 
No comments:
Post a Comment