by Dinesh Thakur Category: Stream

To read a string form the Buffered Reader object, use the following version of readLine() method.

                           String readLine( ) throws IOException

 

Example:

 

import java.io.*;

class StringRead

{

public static void main(String args[]) throws IOException

{

BufferedReader brObj = new BufferedReader(new InputStreamReader(System.in));

String strObj;

System.out.println("Enter lines of string ['exit to quit']");

do

{

strObj = brObj.readLine();

System.out.println(strObj);

} while(!strObj.equals("exit"));

}

}

 

Output:

Reading String

About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.



Search Content







Popular Article