fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6. import java.time.* ;
  7. import java.time.format.* ;
  8.  
  9. /* Name of the class has to be "Main" only if the class is public. */
  10. class Ideone
  11. {
  12. public static void main (String[] args) throws java.lang.Exception
  13. {
  14. System.out.println(
  15. LocalDate
  16. .parse( "2025-01-23" ) // Returns a `LocalDate` object.
  17. .getDayOfWeek() // Returns a `DayOfWeek` enum object. Not text!
  18. .getDisplayName(
  19. TextStyle.SHORT_STANDALONE ,
  20. Locale.forLanguageTag( "en-US" ) // English language, United States culture.
  21. ) // Returns a `String`.
  22. );
  23.  
  24. System.out.println
  25. (
  26. LocalDate
  27. .parse( "2025-01-23" )
  28. .getDayOfWeek() // Extracting a `DayOfWeek` object from the `LocalDate` object. Not text!
  29. .equals( DayOfWeek.FRIDAY ) // Comparing the extracted `DayOfWeek` object to a particular enum object.
  30. );
  31.  
  32. }
  33. }
Success #stdin #stdout 0.16s 60036KB
stdin
Standard input is empty
stdout
Thu
false