BufferedReader example pls. thanks

Recommended Answers

All 2 Replies

This is a simple program that reads Input from Keyboard.

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.lang.String;


public class BufExamp{

BufferedReader br_line;
String inputString;
	public BufExamp()
	{
	br_line	= new BufferedReader(new InputStreamReader(System.in));
	inputString  = new String();
	try{
		System.out.print("Enter Something :  ");
		inputString  = br_line.readLine();
	}catch(Exception err)
		{	System.out.println("Error :"+err);}
	System.out.println("You have entered :"+inputString);
	}

public static void main(String args[])
	{
	System.out.println("Program started ");
	BufExamp Test = new BufExamp();	
	
	}
}

I think there is no need of explanation. if u need reply asap.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.