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. class Ideone
  8. {
  9. public static void main(String[] args)
  10. {
  11. Scanner scan = new Scanner(System.in);
  12.  
  13. System.out.println("Please enter the population of data: ");
  14. int populationOfData = scan.nextInt();
  15. System.out.println(populationOfData);
  16. //Here we just skip to the next line (After nextInt() you HAVE to move to the next line)
  17. scan.nextLine();
  18. System.out.println("Please enter data separated by spaces: ");
  19. String data = scan.nextLine();
  20. System.out.println(data);
  21.  
  22. }
  23. }
Success #stdin #stdout 0.11s 380672KB
stdin
5
1 2 3
stdout
Please enter the population of data: 
5
Please enter data separated by spaces: 
1 2 3