Read Value
Let's How to read value in a variable
import java.util.*;
public class takingInput
{
public static void main(String [] args)
{
System.out.println("Enter your name and age");
Scanner name = new Scanner(System.in);
String nam =name.nextLine();
int age=name.nextInt();
System.out.println("Name: " +nam+" Age :" +age);
}
}
Post a Comment