We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
importjava.io.*;importjava.math.*;importjava.security.*;importjava.text.*;importjava.util.*;importjava.util.concurrent.*;importjava.util.function.*;importjava.util.regex.*;importjava.util.stream.*;importstaticjava.util.stream.Collectors.joining;importstaticjava.util.stream.Collectors.toList;importjava.time.LocalDate;classResult{/* * 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 */publicstaticStringfindDay(intmonth,intday,intyear){LocalDatelt=LocalDate.of(year,month,day);returnlt.getDayOfWeek().name();}}publicclassSolution{publicstaticvoidmain(String[]args)throwsIOException{BufferedReaderbufferedReader=newBufferedReader(newInputStreamReader(System.in));BufferedWriterbufferedWriter=newBufferedWriter(newFileWriter(System.getenv("OUTPUT_PATH")));String[]firstMultipleInput=bufferedReader.readLine().replaceAll("\\s+$","").split(" ");intmonth=Integer.parseInt(firstMultipleInput[0]);intday=Integer.parseInt(firstMultipleInput[1]);intyear=Integer.parseInt(firstMultipleInput[2]);Stringres=Result.findDay(month,day,year);bufferedWriter.write(res);bufferedWriter.newLine();bufferedReader.close();bufferedWriter.close();}}
Cookie support is required to access HackerRank
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 →
SWITCH TO JAVA 8