fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. import java.time.* ;
  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. // Positive-numbered years over 9999 must have a PLUS SIGN character.
  15.  
  16. // SUCCESS
  17. Instant success = Instant.parse( "+190732550-05-25T15:14:51.136Z" ) ;
  18. System.out.println( "success: " + success ) ;
  19.  
  20. // FAIL
  21. Instant fail = Instant.parse( "190732550-05-25T15:14:51.136Z" ) ;
  22. System.out.println( "fail: " + fail ) ;
  23.  
  24.  
  25. }
  26. }
Runtime error #stdin #stdout #stderr 0.15s 55400KB
stdin
Standard input is empty
stdout
success: +190732550-05-25T15:14:51.136Z
stderr
Exception in thread "main" java.time.format.DateTimeParseException: Text '190732550-05-25T15:14:51.136Z' could not be parsed at index 0
	at java.base/java.time.format.DateTimeFormatter.parseResolved0(DateTimeFormatter.java:2049)
	at java.base/java.time.format.DateTimeFormatter.parse(DateTimeFormatter.java:1951)
	at java.base/java.time.Instant.parse(Instant.java:395)
	at Ideone.main(Main.java:21)