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. /* 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. Scanner sc = new Scanner("\n123\n456\n");
  13. System.out.println(sc.nextInt());
  14. System.out.println(sc.nextInt());
  15. System.out.println(sc.nextLine());
  16.  
  17. sc = new Scanner("\n123\n456\n");
  18. System.out.println(sc.next("\\d+"));
  19. System.out.println(sc.next("\\d+"));
  20. System.out.println(sc.nextLine());
  21.  
  22. sc = new Scanner("abc123def456ghi");
  23. sc.useDelimiter("[a-z]+");
  24. System.out.println(sc.nextInt());
  25. System.out.println(sc.nextInt());
  26. System.out.println(sc.nextLine());
  27. }
  28. }
Success #stdin #stdout 0.11s 380608KB
stdin
Standard input is empty
stdout
123
456

123
456

123
456
ghi