veronikaaa86

06. Concatenate Data

May 8th, 2021
518
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.company;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class ConcatenateData {
  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.         //System.out.println("You are " + firstName + " " + lastName + ", a " + age + "-years old person from " + town);
  15.  
  16.         System.out.printf("You are %s %s, a %d-years old person from %s.", firstName, lastName, age, town);
  17.     }
  18. }
  19.  
RAW Paste Data