desislava_topuzakova

Untitled

Sep 19th, 2021
309
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class ConcatenateData_06 {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6. String firstName = scanner.nextLine();
  7. String lastName = scanner.nextLine();
  8. int age = Integer.parseInt(scanner.nextLine());
  9. String town = scanner.nextLine();
  10.  
  11. //"You are <firstName> <lastName>, a <age>-years old person from <town>."
  12.  
  13. //%s -> string; %d -> int; %f -> double; %c -> char; %n \n -> new line
  14. System.out.printf("You are %s %s, a %d-years old person from %s.%n", firstName, lastName, age, town);
  15.  
  16. }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment