Advertisement
veronikaaa86

06. Concatenate Data

May 7th, 2022
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class P06ConcatenateData {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. //You are <firstName> <lastName>, a <age>-years old person from <town>.
  8.  
  9. String firstName = scanner.nextLine();
  10. String lastName = scanner.nextLine();
  11. int age = Integer.parseInt(scanner.nextLine());
  12. String town = scanner.nextLine();
  13.  
  14. String data = "You are "
  15. + firstName + " "
  16. + lastName + ", a "
  17. + age + "-years old person from "
  18. + town + ".";
  19. System.out.println(data);
  20. }
  21. }
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement