Fresh Information, Great Ideas, Latest Product Review & Specification » Computer & Gadget

Fresh Information, Great Ideas, Latest Product Review & Specification » Home and Appliances

Fresh Information, Great Ideas, Latest Product Review & Specification » Camera & Photography

Thursday, June 24, 2010

Java program for input output sample!

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
public class GetInputFromKeyboard
{
public static void main( String[] args ){
BufferedReader dataIn = new BufferedReader(new
InputStreamReader( System.in) );
String name = "";
String Age = "";
System.out.println("Please Enter Your Name:");

System.out.println("Enter Your Age");
try{
name = dataIn.readLine();
Age = dataIn.readLine();
}catch( IOException e ){
System.out.println("Error!");
}
System.out.println("Hello " + name + "" + "and you are " + Age + "" + "Years Old");
}
}

No comments:

Post a Comment