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 kbReader = new Scanner (System.in);
  13. System.out.print("Enter an intger here: ");//enter 3001
  14. int i = kbReader.nextInt();//read the double from the console
  15. System.out.println(3 * i);
  16.  
  17. System.out.print("Enter your decimal here: ");//enter 1000.5
  18. double d = kbReader.nextDouble();//read the double from the console
  19. System.out.println(3 * d);
  20.  
  21. String s = kbReader.next(); //inputs up to first white space
  22. System.out.println("Enter your String here: "+ s);//Enter One Two
  23. s = kbReader.next();
  24. System.out.println("This is the first part of the String..."+ s);
  25. s = kbReader.next();
  26. System.out.println("This is the next part of the String,..."+ s);
  27.  
  28. String j = kbReader.next();
  29. System.out.println("Enter your String here: "+ j);
  30. String b = kbReader.nextLine();
  31. System.out.println("This is my string..."+ j);
  32.  
  33. }
  34. }
Success #stdin #stdout 0.19s 58960KB
stdin
4167
8735.6
Nine_Four
Nine
Four
Nine_Four
Nine_Four
stdout
Enter an intger here: 12501
Enter your decimal here: 26206.800000000003
Enter your String here: Nine_Four
This is the first part of the String...Nine
This is the next part of the String,...Four
Enter your String here: Nine_Four
This is my string...Nine_Four