Java - Interview Questions and Answers for 'Factory' | Search Java Interview Question - javasearch.buggybread.com
Javasearch.buggybread.com
Share

Search Java Interview Questions


 2098 questions in repository.
 There are more than 200 unanswered questions.
Click here and help us by providing the answer.
Label / Company      Label / Company / Text

   



Interview Questions and Answers for 'Factory' - 10 question(s) found - Order By Newest

 Q1. Difference between Factory and Abstract Factory Design Pattern ?Design
Anonymous
Ans. Factory Pattern deals with creation of objects delegated to a separate factory class whereas Abstract Factory patterns works around a super-factory which creates other factories.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     java   design pattern   factory design pattern   abstract factory design pattern   technical lead      expert


 Q2. Difference between Factory and Builder Design Pattern ?Design
Anonymous
Ans. Builder pattern is the extension of Factory pattern wherein the Builder class builds a complex object in multiple steps.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     java   design pattern   factory design pattern   builder design pattern      expert


 Q3. Difference between Factory and Strategy Design Pattern ?Design
Anonymous
Ans. Factory is a creational design pattern whereas Strategy is behavioral design pattern. Factory revolves around the creation of object at runtime whereas Strategy or Policy revolves around the decision at runtime.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     java   design pattern   factory   strategy   creational design pattern   behavioral design pattern     Alibaba      expert


 Q4. What is ThreadFactory ?Core Java
Admin
info@buggybread.com
Ans. ThreadFactory is an interface that is meant for creating threads instead of explicitly creating threads by calling new Thread(). Its an object that creates new threads on demand. Using thread factories removes hardwiring of calls to new Thread, enabling applications to use special thread subclasses, priorities, etc.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     java   threads   multi threading   thread factory   thread creation   advanced      expert


 Q5. How many SessionFactory and Session objects are created ?Java EE
Admin
info@buggybread.com
Ans. Single SessionFactory object and multiple session objects for opening different session. Hibernate creates new Session object per thread.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     hibernate   sessionfactory hibernate   session hibernate


 Q6. What are the advantages and disadvantages of Factory Design Pattern ?Design2016-09-07 09:19:26

Ans. Object Oriented Design Patterns is the science of identifying the pattern to make objects communicate in a way to effectively implement a Solution.

Factory Design Patterns is the pattern that recommends creation of separate Factory Object for creation of other object. So its like saying - If you want to create an object of ClassA, Talk to FactoryObject ( which is an object of FactoryClass ). FactoryObject in itself encapsulates the inputs and logic required to make the decision regarding the creation and construction of object.

Advantage of Factory Pattern - Loose Coupling and Segregation of Responsibilities. Now instead of hard binding the complete logic to decide the nature and shape of the object on the basis of some conditions, you are assigning the responsibility to some other object and hence making the relationship loosely coupled and hence main tenable.

Disadvantages - Before Understanding the Dis-advantages , we should understand that these patterns were chosen after a period of evolution and research and almost best fit for the required solution, otherwise these patterns would have easily been replaced by now.

Though the advantages of these pattern surpass the disadvantages keeping in mind the decreasing cost of resources and increasing scale of applications, but still loose coupling by means of additional objects results in decreased performance.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     factory design pattern  design pattern


 Q7. What is a factory design pattern ?Design2017-01-09 13:21:43

Ans. Factory Design Patterns is the pattern that recommends creation of separate Factory Object for creation of other object. So its like saying - If you want to create an object of ClassA, Talk to FactoryObject ( which is an object of FactoryClass ). FactoryObject in itself encapsulates the inputs and logic required to make the decision regarding the creation and construction of object.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     design pattern  factory design pattern     EPAM  EMC  TMP Worldwide  Sapient  Ernst & Young (EY)   ThyssenKrupp Materials  Wipro  Scotiabank


 Q8. Difference between Singleton and Factory Design Pattern ?Design2017-02-02 11:24:01

Ans. Both are creational design patterns but singleton facilitates in creation and reuse of single object whereas Factory deals with creation of multiple objects.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     Design pattern  singleton  factory  singleton vs factory     Jabong.com  Intuit  Kumaran Systems  BirlaSoft


 Q9. What are the trade offs between public constructor and static final method ?Core Java2017-05-07 19:26:45

Ans. Public constructor is simple and easy as it's the default way of object creation. So there are no additional coding overheads as compiler provides the default constructor if none is provided by coder.

With static final methods, it facilitates loose coupling by segregating the responsibility of object creation to a separate method. Validation can be done on the constructor arguments before calling it. Moreover if any adaption on the arguments is required that can achieved easily with factory method.On the flip side, there is coding overhead and additional method call.

  Sample Code for constructor

  Sample Code for factory

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     constructor  factory design pattern  factory method



Do you think these are the Best Java Frameworks ?

OpenXavaSPRING MVCApache StripesCheck everything
that is Best in Java

Click Here



 Q10. Difference between ApplicationContext and BeanFactory ?Spring2017-06-23 11:50:50

 This question is still unanswered. Can you please provide an answer.


 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     ApplicationContext  BeanFactory   ApplicationContext vs BeanFactory        frequent




Subscribe to Java News and Posts. Get latest updates and posts on Java from Buggybread.com
Enter your email address:
Delivered by FeedBurner



comments powered by Disqus
 

Help us and Others Improve. Please let us know the questions asked in any of your previous interview.

Any input from you will be highly appreciated and It will unlock the application for 10 more requests.

Company Name:
Questions Asked:
         

X Close this

X Close this

Help Us Improve.
Please share your
interview experience.

Company Name:   


Questions Asked: