+ 2

What is bufferReader? Give some details about it n usefulness about it...

plzzz give one example to explain d whole thing

8th May 2018, 4:11 PM
Harsh Agrawal
Harsh Agrawal - avatar
4 odpowiedzi
+ 3
Buffered Reader is just like Scanner... BUT, Buffered Reader throws exceptions which makes it unworthy. Whenever we declare Buffered Reader, we also have to declare a statement for IOException. Thus, we prefer Scanned over Buffered Reader. For example, 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 ); } } Hope it helped... If liked plz follow me😅😉
8th May 2018, 4:32 PM
Mayank Rampuriya
Mayank Rampuriya - avatar
+ 1
Martin Taylor I like your way to go direct to point 😁
9th May 2018, 2:29 PM
KrOW
KrOW - avatar
0
Can u explain me this line ? why u used this line n what dis need in d program? Mayank Rampuriya can we used in single line n yes so how? String inputString= input.readline();
9th May 2018, 7:16 AM
Harsh Agrawal
Harsh Agrawal - avatar
0
Mayank Rampuriya... Stringing inputstring=input.readLine() basically reads the keys from the keyboard as a buffer....double radius=Double.parseDouble(inputString) converts what u entered from the keyboard to double data type...then the double data can be used in ur program....this is the basic explanation...that u can understand from above....readLine() is a function of BufferedReader class...
9th May 2018, 6:36 PM
Suhail Ahmad
Suhail Ahmad - avatar