fork download
  1. import java.util.*;
  2.  
  3. /* Name of the class has to be "Main" only if the class is public. */
  4. class Ideone
  5. {
  6. public static void main (String[] args) throws java.lang.Exception
  7. {
  8. Scanner scan = new Scanner(System.in);
  9.  
  10. System.out.println("Enter an integer: ");
  11. int intNum = scan.nextInt();
  12.  
  13. System.out.println("Enter a double: ");
  14. double doubleNum = scan.nextDouble();
  15.  
  16. System.out.println("Enter your string: ");
  17. scan.nextLine();
  18. String str=scan.nextLine();
  19.  
  20. scan.close();
  21. System.out.println("Your string is: "+ str);
  22. System.out.println("Your double is: "+ doubleNum);
  23. System.out.println("Your integer is: "+ intNum);
  24. }
  25. }
Success #stdin #stdout 0.08s 2184192KB
stdin
88
11.1
Hello world
stdout
Enter an integer: 
Enter a double: 
Enter your string: 
Your string is: Hello world
Your double is: 11.1
Your integer is: 88