Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Demo {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String name = scanner.nextLine(); //име
- String lastName = scanner.nextLine(); //фамилия
- int age = Integer.parseInt(scanner.nextLine()); //възраст
- //печатам: "I am <name> <lastName> on <age> years old."
- //шаблони
- //%d -> int
- //%f -> double
- //%s -> String
- System.out.printf("I am %s %s on %d years old.", name, lastName, age);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement