+ 21

scanner vs bufferreader

in java what to choose for input command ..I am just confused.

5th Aug 2018, 4:11 AM
Yesh Jadav
Yesh Jadav - avatar
18 Réponses
+ 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()
6th Aug 2018, 2:32 AM
Tarika
Tarika - avatar
+ 12
use Scanner declare Scanner name = new Scanner (System.in) ; its simple
7th Aug 2018, 2:37 AM
Unknown
+ 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😅
5th Aug 2018, 4:23 PM
$hardul B
$hardul B - avatar
+ 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!
5th Aug 2018, 6:15 AM
Alexander Sokolov
Alexander Sokolov - avatar
5th Aug 2018, 2:36 PM
$hardul B
$hardul B - avatar
+ 6
Yesh Jadav Did you google it? Also what about the answers Bit gave to you?
5th Aug 2018, 5:49 AM
Manual
Manual - avatar
+ 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.
5th Aug 2018, 4:20 PM
Yesh Jadav
Yesh Jadav - avatar
+ 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
5th Aug 2018, 6:40 PM
Alex Arhort
+ 5
so for bufferreader Bit
5th Aug 2018, 5:39 AM
Yesh Jadav
Yesh Jadav - avatar
+ 5
I have but it make difference when I used in sl codeplayground
5th Aug 2018, 5:51 AM
Yesh Jadav
Yesh Jadav - avatar
+ 4
Take your time 😂 $hardul Birje
5th Aug 2018, 4:24 PM
Yesh Jadav
Yesh Jadav - avatar
+ 2
e.g int n=sc.nextInt(); double d=sc.nextDouble();
6th Aug 2018, 2:33 AM
Tarika
Tarika - avatar
+ 2
d@ni in other ide mostly we come up with buffer reader not scanner
7th Aug 2018, 3:02 AM
Yesh Jadav
Yesh Jadav - avatar
+ 1
I just write with cpp. What are you speak about it
6th Aug 2018, 4:47 AM
Adriana(Addy)#be Crazy
Adriana(Addy)#be Crazy - avatar
+ 1
google)
6th Aug 2018, 6:38 PM
Sasha Fox
Sasha Fox - avatar
+ 1
google it is the best way
7th Aug 2018, 5:36 AM
Malvern Bradbury
+ 1
ho
7th Aug 2018, 3:13 PM
Noah
Noah - avatar
+ 1
hi
7th Aug 2018, 3:13 PM
Noah
Noah - avatar