+ 21
scanner vs bufferreader
in java what to choose for input command ..I am just confused.
18 Respostas
+ 12
if you are using BufferedReader then you have to convert your input into the specific type
e.g int n=Integer.parseInt(br.readLine());
but Scanner class provides a method like nextInt(),nextDouble()
+ 12
use Scanner
declare
Scanner name = new Scanner (System.in) ;
its simple
+ 8
Well I had came across an article which said that Scanner gives you an option to specify the type of input while buffered reader doesn't... Regarding your example I might need some time...//exams are coming closerš
+ 7
Hello, Yesh Jadav !
Please use the search option before publishing the question. This will help avoid duplication of questions in the community SoloLearn.
https://www.sololearn.com/Discuss/665071/?ref=app
Good luck in programming on SoloLearn!
+ 7
+ 6
Yesh Jadav
Did you google it?
Also what about the answers Bit gave to you?
+ 6
$hardul Birje I have readed and I have got to that post but if example is available for understanding then it will be great with both outputs.
+ 6
it*s really depend of your nesseserity, if u need to get data from user in real time u are using Scanner, when u need to read a lot of data from some url, then u are using BufferReader. Just try it
+ 5
so for bufferreader Bit
+ 5
I have but it make difference when I used in sl codeplayground
+ 4
Take your time š $hardul Birje
+ 2
e.g int n=sc.nextInt();
double d=sc.nextDouble();
+ 2
d@ni in other ide mostly we come up with buffer reader not scanner
+ 1
I just write with cpp. What are you speak about it
+ 1
google)
+ 1
google it is the best way
+ 1
ho
+ 1
hi