What is the benefit of using a factory class in the following code?

Posted by Emanuil on Stack Overflow See other posts from Stack Overflow or by Emanuil
Published on 2010-06-11T09:17:18Z Indexed on 2010/06/11 9:22 UTC
Read the original article Hit count: 144

Filed under:
|
|

Here's the code:

SAXParserFactory mySAXParserFactory = SAXParserFactory.newInstance();
SAXParser mySAXParser = mySAXParserFactory.newSAXParser();

Why use that if you can use something like:

SAXParser mySAXParser = new SAXParser();

© Stack Overflow or respective owner

Related posts about java

Related posts about best-practices