Monday, March 12, 2018

Java interview question for experienced at GS Lab.

Q1) How multi threading happens in JAVA.

Q2) How to avoid in imutable class not to create a new instance if mutable object setter is called within?
Ans) Hint - Use clone of object within the constructor

Q3) How can we avoid performance hit if used synchronize in Singleton class.
Ans ) Hint - use Enum instead of singleton instance creation.

Please provide you answers in comment secssion.