user information input program.
import java.util.*;
public class YearOfTheRat
{
public static void main (String[] args)
{
int nYear = 2008 , nAge, nBorn;
String strName;
System.out.printlin(nYear + "Year of the Rat\n" + "Good Afternoon!");
System.out.print("What is your name?");
Scanner sc = new Scanner (system.in);
strName = sc.nextLine();
System.out.print("How old are you?");
nAge = sc.nextInt();
System.out.println(strName + " born on" + nYear);
sc.close();
{
{
Output:
2008 Year of the Rat
Good Afternoon!
What is your name? //input name here.
How old are you? //input age here
name born on year born
Blog Archive
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment