class PrintName{   	                                	//Name is the class name which is not main class

    void setWish(String nameread){				// Method name is setWish with string parameter
        System.out.println("Hello "+nameread+"."+" Welcome!");	// printing the required output

class PrintString{						        // main class name
    public static void main(String args[]) throws IOException{
        BufferedReader br=new BufferedReader(new InputStreamReader(;
        //reading input stream
        PrintName pn=new PrintName();			// creating object for Name class
        System.out.print("Enter the Name:");
        String nameread=br.readLine();			//nameread string variable takes the input value
        pn.setWish(nameread);				// calling method setWish with one argument nameread.



Enter the Name:Sekhar
Hello Sekhar. Welcome!