Print the age

Report a typo

Here's a program that reads an integer age and outputs a string with this integer. But something is broken in the code!

Fix all compile-time errors in the snippet and make it work.

Sample Input 1:

22

Sample Output 1:

My age is 22
Write a program in Java 17
import java.util.Scanner;

public clas Main {
public static void main(String() args) {
Scanner scanner = new Scanner(System.in);
int age = scanner.nextInt();
System.out.printf("My age is %d", age);
}
}
___

Create a free account to access the full topic