Program:
import java.util.*;
public class InputValues
{
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
// Your name
System.out.print("What is your name? ");
String name = in.nextLine();
// Your age
System.out.print("How old are you? ");
int age = in.nextInt();
System.out.println("Hello, " + name + ". Your Age is "+ age +". Nice to Meet You");
}
}
Output:
Hello, bsb. Your Age is 23. Nice to Meet You
System.out.print("How old are you? ");
int age = in.nextInt();
System.out.println("Hello, " + name + ". Your Age is "+ age +". Nice to Meet You");
}
}
Output:
Hello, bsb. Your Age is 23. Nice to Meet You
No comments:
Post a Comment