aspose file tools*
The moose likes Beginning Java and the fly likes Scanner class and character input Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Scanner class and character input" Watch "Scanner class and character input" New topic
Author

Scanner class and character input

michael delta
Ranch Hand

Joined: Aug 11, 2009
Posts: 35

Why isn't scanner class an efficient way to receive input from the keyboard?Which way suits this need?
Greg Stevens
Ranch Hand

Joined: Jul 23, 2009
Posts: 41
I'm just guessing here, but I think it would be because a Scanner is not buffered.
Greg Stevens
Ranch Hand

Joined: Jul 23, 2009
Posts: 41
I found this.

I just read the content of that link more carefully, and I think it might not be quite right.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36486
    
  16
The only reason Scanner isn't efficient is because keyboards are slow. Scanner itself is very efficient and versatile, once you have found out about 1\n being parsed as integer 1 followed by an empty line. Scanner is a far better way to read from the keyboard than the old Reader method.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Scanner class and character input
 
Similar Threads
TextIO class - Matter copied from unrelated thread
StringBuffer
Using Scanner to read a single character
how can i separate string?