Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class ConcatenateData_02 {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- //1. прочитаме от конзолата: име
- //2. прочитаме от конзолата: фамилия
- //3. прочитаме от конзолата: възраст
- //4. прочитаме от конзолата: град
- //5. отпечатвам: "You are <firstName> <lastName>, a <age>-years old person from <town>."
- String name = scanner.nextLine();
- String lastName = scanner.nextLine();
- int age = Integer.parseInt(scanner.nextLine());
- String town = scanner.nextLine();
- //System.out.println("You are " + name + " " + lastName + ", a " + age + "-years old person from " + town + ".");
- System.out.printf("You are %s %s, a %d-years old person from %s.", name, lastName, age, town);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment