Computer Science, asked by arnavdang007, 1 year ago

how to use buffered reader

Answers

Answered by nancyyy
3
Hi..
Buffered is used in java to take inputs.

Here's an example to make you understand easliy:

•To read from the console we must use a BufferedReader object. But the BufferedReader class is in the package java.io and has to imported. The following program snippet shows how to read and write to the console.

import java.io.*;

public class CalcArea
{
public static void main ( String args[] ) throws IOException
{
System.out.print ( "Enter the radius: " );

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

String inputString = input.readLine();

double radius = Double.parseDouble ( inputString );

double area = 3.14159 * radius * radius;

System.out.println ( "Area is: " + area );
}

arnavdang007: thanks you
nancyyy: Your welcome:-)
Answered by Anonymous
2
Coding :
import java. io. *;
public class name
{
public static void main (String args[]) throws IOException
{
InputStreamReader read =new InputStreamReader (System. in) ;
BufferedReader in = new BufferedReader(read) ;
Body............
......................
......................
}
}

# Mark brainliest

arnavdang007: thank you
Anonymous: Mark brainliest...
Similar questions