Answer:
Following are the code to this question:
import java.util.*;//import package
public class Main//defining class Main
{
public static void main(String[] as)//defining main method
{
Scanner obx= new Scanner(System.in);//creating Scanner class Object
String name = obx.next();//input String value in name variable
int age = obx.nextInt();//input integer value in age variable
System.out.println("The age of " + name + " is " + age);//print value with message
}
}
Output:
Rohit
70
The age of Rohit is 70
Step-by-step explanation:
The description of the given java code can be defined as follows:
- In the above java code, two-variable "name and age " is declared, in which name is string variable and age is an integer variable.
- In the next step, the scanner class object is created, in which we input values in the variable and use the print method to print its value with the message.