BufferedReader Code Example Java Programming

http://www.studytonight.com/java/images/bufferedreader-class-explanation.gif

Write a Java program by using BufferedReader class to prompt a user
to input his/her name and then the output will be shown as an example below:
Welcome to Cambodia, Bill Gates!
Solution:
package javaapplication1;

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class UBB {

    public static void main(String[] args) throws Exception{
       
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String name;
        System.out.print("Please input your name: ");
        name = reader.readLine();
        System.out.println("Welcome to Cambodia, "+name+"!");
        
    }    
}