PhysicsTeacher.in

High School Physics + more

Java program – using BufferedReader & InputStreamReader

Here is a Java program that helps you to understand the use of BufferedReader & InputStreamReader. Type, compile, and run to understand how to use the BufferedReader & InputStreamReader in a Java program.

In this program, multiple lines of text can be received as input until a specific word is not entered as line content.

using BufferedReader & InputStreamReader in a Java program

import java.io.*;
class BufferedReaderTest
{
public static void main(String args)
{
BufferedReader br=new BufferedReader(new BufferedReader(new InputStreamReader(System.in)));
String str;
System.out.println(“Enter lines of text”);
System.out.println(“Enter stop to quit”);
do
{
str=br.readLine();
System.out.println(str);
}
while(!str.equals(“stop“));
}
}

See also  Java Program to test polymorphism
Scroll to top
error: physicsTeacher.in