fork(1) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.time.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. // fevereiro de 2019
  13. YearMonth.of(2019, 2)
  14. // tenta setar o dia para 31
  15. .atDay(31);
  16. // dá erro porque fevereiro não tem dia 31
  17. }
  18. }
Runtime error #stdin #stdout #stderr 0.15s 2184192KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Exception in thread "main" java.time.DateTimeException: Invalid date 'FEBRUARY 31'
	at java.time.LocalDate.create(LocalDate.java:431)
	at java.time.LocalDate.of(LocalDate.java:269)
	at java.time.YearMonth.atDay(YearMonth.java:1095)
	at Ideone.main(Main.java:15)