Advertisement
veronikaaa86

06. Concatenate Data

Oct 2nd, 2021
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. package firstSteps;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class P06ConcatenateData {
  6. public static void main(String[] args) {
  7. Scanner scanner = new Scanner(System.in);
  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. //You are <firstName> <lastName>, a <age>-years old person from <town>.
  15.  
  16. System.out.println("You are " +
  17. firstName +
  18. " " +
  19. lastName +
  20. ", a " +
  21. age +
  22. "-years old person from " +
  23. town +
  24. ".");
  25. }
  26. }
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement