Please explain me the difference between scanner and the buffer reader?

0 votes
Hi, I have a doubt why buffer reader is safer to take user input in java?

Can you explain that to me?

Thank you,
Aug 2 in Java by Bipasa
19 views

1 answer to this question.

0 votes
  1. BufferedReader is synchronous while Scanner is not. 
  2. BufferedReader should be used if we are working with multiple threads.
  3. BufferedReader has significantly larger buffer memory than Scanner.
  4. The Scanner has a little buffer as opposed to the BufferedReader, but it’s more than enough.
  5. BufferedReader is a bit faster as compared to scanner because the scanner does parsing of input data and BufferedReader simply reads a sequence of characters.
I hope this will help you to understand the difference,
Thank you
answered Aug 2 by Sampriti
• 1,100 points

Related Questions In Java

+1 vote
1 answer

Can you please explain the difference between string, string buffer and string builder?

String are immutable where as StringBuffer and ...READ MORE

answered Jul 4 in Java by Akash
• 160 points
54 views
0 votes
1 answer

Can you explain what is the difference between hashtable and hashmap?

Hi, Hashtable is synchronized, whereas HashMap is not. This makes HashMap better for ...READ MORE

answered 4 days ago in Java by anonymous
19 views
0 votes
2 answers

What is the difference between implements and extends?

Extends : This is used to get attributes ...READ MORE

answered Aug 3, 2018 in Java by samarth295
• 2,190 points
449 views
0 votes
1 answer

What is the difference between jdk and jre?

JRE: It stands for Java Runtime Environment. ...READ MORE

answered Apr 20, 2018 in Java by Akrati
• 3,150 points
116 views
0 votes
1 answer

Are arrays equivalent to objects in Java ?

Yes; the Java Language Specification writes: In the Java ...READ MORE

answered May 10, 2018 in Java by Rishabh
• 3,540 points
51 views
0 votes
1 answer

Remove objects from an array in Java?

We can use external libraries: org.apache.commons.lang.ArrayUtils.remove(java.lang.Object[] array, int ...READ MORE

answered Jun 26, 2018 in Java by scarlett
• 1,280 points
42 views
0 votes
1 answer

Performance difference of if/else vs switch statement in Java

The thing you are worried about is ...READ MORE

answered Jul 26, 2018 in Java by geek.erkami
• 2,320 points
342 views
+1 vote
3 answers

What is the syntax to declare and initialize an array in java?

You can use this method: String[] strs = ...READ MORE

answered Jul 25, 2018 in Java by samarth295
• 2,190 points
251 views
0 votes
1 answer

What is the difference between Map and HashMap in java?

Hi Sanhati, I understand your doubt regarding map ...READ MORE

answered May 31 in Java by Sampriti
• 1,100 points
81 views
0 votes
1 answer

Can you give me the proper difference between java.util.Date vs java.sql.Date ?

As per Javadoc java.sql.Date is a thin wrapper around millisecond ...READ MORE

answered Aug 2 in Java by Sampriti
• 1,100 points
15 views