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 ( "Runtime.version() = " + Runtime.version() ) ;
  15.  
  16. System.out.println
  17. (
  18. java.time.Month.of ( 1 ) // Get `Month` enum object for month number, 1-12 for January-December.
  19. .getDisplayName ( // Generate localized text for name of this month.
  20. TextStyle.FULL_STANDALONE , // Month name spelled out, not abbreviated.
  21. Locale.forLanguageTag ( "en-US" ) // English language, United States cultural norms.
  22. ) // Returns string with localized text such as “January”.
  23. );
  24.  
  25. int monthNumber = 1 ;
  26. Month month = Month.of ( monthNumber ) ;
  27. TextStyle style = TextStyle.FULL_STANDALONE ;
  28. Locale locale = Locale.forLanguageTag ( "fr-CA" ) ; // ( "en-US" ) ;
  29. String output = month.getDisplayName ( style , locale ) ;
  30.  
  31. System.out.println ( output ) ;
  32. }
  33. }
Success #stdin #stdout 0.23s 62300KB
stdin
Standard input is empty
stdout
Runtime.version() = 12.0.1+12
January
janvier