fork(1) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone {
  9. public static void main (String[] args) throws java.lang.Exception {
  10. System.out.println(lerInt());
  11. }
  12. public static int lerInt() {
  13. while (true) {
  14. try {
  15. return Integer.parseInt(input.readLine());
  16. } catch (IOException e) {
  17. System.out.println("Falha critica.");
  18. } catch (NumberFormatException e) {
  19. System.out.println("VocĂȘ digitou uma entrada invalida.");
  20. }
  21. }
  22. }
  23. }
Success #stdin #stdout 0.07s 380224KB
stdin
abc
1d3
12
stdout
Você digitou uma entrada invalida.
Você digitou uma entrada invalida.
12