Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does java.util.Scanner exist? [duplicate]

Possible Duplicate:
Scanner vs. BufferedReader

Is there any situation in which it's apropriate to use java.util.Scanner in order to read input of some sort? In my small test I've found it to be incredibly slow compared to java.util.Bufferedreader or implementing your own reader from java.util.InputStreamReader.

So is there any reason as to why I would want to use a Scanner?

like image 634
Rovanion Avatar asked May 18 '26 20:05

Rovanion


1 Answers

From the docs:

A simple text scanner which can parse primitive types and strings using regular expressions.

That won´t do a BufferedReader.

like image 200
PeterMmm Avatar answered May 21 '26 10:05

PeterMmm



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!