You were correct in you assumption. Now you can scan from Files, String and Readables in addition to streams.Originally posted here by hypronix
But yeah, it was first released in 1.5 beta 1, used to get called as:
but in the stable version it gets called like soCode:Scanner varName = Scanner.create(System.in);
Code:Scanner varName = new Scanner (System.in);
As far as the visible change, from method call to constructor, they were using a factory to create them before, meaning that the one method (create()) did all of the hard work for you, my guess is that they changed it from an extendable or abstract class/interface into a final class and decided to make the constructors public because they can't be extended now, and besides a factory isn't necessary in a final class, because the purpose of a factory is to return an instance of the proper sub-class.
If you would like to know more about factory patterns or any of the many other software design patterns and their many benefits check out some of these sites:
http://www.dofactory.com/patterns/Patterns.aspx
http://hillside.net/patterns/
http://www.cs.wustl.edu/~schmidt/patterns.html
and many, many more...




Reply With Quote