// the data that will be entered by the user
String name;
// an instance of the BufferedReader class
// will be used to read the data
BufferedReader reader;
// specify the reader variable
// to be a standard input buffer
reader = new BufferedReader(new InputStreamReader(System.in));
// ask the user for their name
System.out.println("What is your name?");
// read the data entered by the user using
// the readLine() method of
// the BufferedReader class
// and store the value in the name variable
try {
name = reader.readLine();
System.out.println("Your name is " + name);
} catch (IOException e) {
//e.printStackTrace();
System.out.println("An unexpected error occured.");
}
}