Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. package uuu;
  2. import java.util.Scanner;
  3. public class UUU {
  4.  
  5. public static void main(String[] args) {
  6. Scanner input = new Scanner(System.in);
  7. int a;
  8. System.out.print("Hola dime tu nombre");
  9. a=input.nextInt();
  10. System.out.print("Mucho gusto en conocerte "+a);
  11.  
  12.  
  13.  
  14. // TODO Auto-generated method stub
  15.  
  16. }
  17.  
  18. }
  19.  
  20. Hola dime tu nombre
  21. alda
  22. Exception in thread "main" java.util.InputMismatchException
  23. at java.util.Scanner.throwFor(Unknown Source)
  24. at java.util.Scanner.next(Unknown Source)
  25. at java.util.Scanner.nextInt(Unknown Source)
  26. at java.util.Scanner.nextInt(Unknown Source)
  27. at uuu.UUU.main(UUU.java:9)
  28.  
  29. package uuu;
  30. import java.util.Scanner;
  31. public class UUU {
  32.  
  33. public static void main(String[] args) {
  34. Scanner input = new Scanner(System.in);
  35. String a;
  36. System.out.print("Hola dime tu nombre");
  37. a=input.nextLine();
  38. System.out.print("Mucho gusto en conocerte "+a);
  39.  
  40. // TODO Auto-generated method stub
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement