galinyotsev123

ProgBasics02Simple-Operations-P04ConcatenateData2

Jan 11th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class P04ConcatenateData2 {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. String firstName = scanner.nextLine();
  8. String lastName = scanner.nextLine();
  9. int age = Integer.parseInt(scanner.nextLine());
  10. String city = scanner.nextLine();
  11.  
  12. System.out.printf("You are %s %s, a %d-years old person from %s.", firstName, lastName, age, city ) ;
  13. }
  14. }
  15. //import java.util.Scanner;
  16. //
  17. //public class Main {
  18. // public static void main(String[] args) {
  19. // Scanner scanner = new Scanner(System.in);
  20. //
  21. // String firstName = scanner.nextLine();
  22. // String lastName = scanner.nextLine();
  23. // int age = Integer.parseInt(scanner.nextLine());
  24. // String city = scanner.nextLine();
  25. //
  26. // System.out.printf("You are %s %s, a %d-years old person from %s.\n", firstName, lastName, age, city ) ;
  27. // System.out.println();
  28. // }
  29. //}
Advertisement
Add Comment
Please, Sign In to add comment