Advertisement
Guest User

Untitled

a guest
Aug 29th, 2016
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class BasicInput {
  4. public static void main(String[] args) {
  5. Scanner scnr = new Scanner(System.in);
  6.  
  7.  
  8. int userInt = 0;
  9. double userDouble = 0.0;
  10. char userChar;
  11. String userStr;
  12.  
  13. System.out.println("Enter integer: ");
  14. userInt = scnr.nextInt();
  15.  
  16. System.out.println("Enter a double");
  17. userDouble = scnr.nextDouble();
  18.  
  19. System.out.println("Enter a character");
  20. userChar = scnr.next().charAt(0);
  21.  
  22. System.out.println("Enter a string");
  23. userStr = scnr.nextLine();
  24.  
  25. System.out.println(userStr + " " + userChar + " " + userDouble + " " + userInt);
  26.  
  27. userDouble = userInt;
  28.  
  29. System.out.println(userInt);
  30.  
  31.  
  32.  
  33. return;
  34. }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement