• Post Reply Bookmark Topic Watch Topic
  • New Topic

javax.xml.parsers.DocumentBuilderFactory,static newInstance's concrete implementation.  RSS feed

 
Punya Pratap Singh
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
javax.xml.parsers.DocumentBuilderFactory is a Abstract class .It has a newInstance method which returns a instance of type DocumentBuilderFactory .
how does this static method finds implementing concrete class.
Java have already gone through java docs and asking for simple and easy in depth explanation.

please explain ? Thanks

 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
probably, newInstance method is instantiate a class[subclass of DocumentBuilderFactory] which is implementation of DocumentBuilderFactory.
<edit>
also, google for static factory method
</edit>
 
Rob Spoor
Sheriff
Posts: 21131
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Inside the JDK installation folder there is a file called src.zip. You can open that to see the source code of most classes.

In this case, it uses a system property for the actual class name. If the system property is not found a default one will be used.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!