File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What is a factory class?

 
Bindu Puvvala
Greenhorn
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Book says java.util.Collections is a factory class. What is a factory class at all?
 
wise owen
Ranch Hand
Posts: 2023
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A factory class is a standard design pattern that gives you the ability to manufacture classes as needed.
 
Bindu Puvvala
Greenhorn
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you mean a factory class can be used as a base class, from which required classes can be derived?
 
Priya Balaraman
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
absolutely. U state your requirements and it shall be manufactured
 
Marcus Green
arch rival
Rancher
Posts: 2813
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Do you mean a factory class can be used as a base class, from which required classes can be derived?"

That doesn't really encapsulate the expectations of what a factory class is,

"The Factory Pattern is all about "Define an interface for creating an object, but let the subclasses decide which class to instantiate. The Factory method lets a class defer instantiation to subclasses" Thus, as defined by Gamma et al, "The Factory Method lets a class defer instantiation to subclasses".

http://gsraj.tripod.com/design/creational/factory/factory.html

However the SCJP exam has absolutely no expectation of an understanding of Design Patterns so don't worry about it too much. Design patterns are a big deal in the world of Java programming, but not the SCJP. Design Patterns are covered by the SCWCD exam (but as it so happens not the Factory pattern).
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic