Interview Questions and Answers - Order By Newest Q101. Which are the most commonly used Design Patterns ? Design
Ans. Builder ( While Writing Unit Tests )
Prototype ( Cloning )
Adapter ( asList , toString )
Chain Of Responsibility ( Logging )
Singleton
Factory ( Action Mapping )
Proxy
Observer ( Event Listener )
MVC ( Web frameworks )
Filter ( Criteria ) Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  Design Patterns  widely used Design patterns intermediate   frequent Try 1 Question(s) Test Q102. What is the purpose of String Pool ? Don't you think it's a performance overhead to have unnecessary check for string in string pool ? Core Java
Ans. String Pool makes Java more memory efficient by providing a reusable place for string literals. It might be a little performance inconvenience but results in good amount memory saving. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  string pool  memory management Intermediate Q103. Can we catch errors in Java ? Core Java
Ans. Yes we can
try {
// code
} catch (Error ex) {
// handling code
}
but we shouldn't ideally do that as errors are mostly JVM based and not application based and there is rarely we can do something about it. Very likely catching and not re throwing would lead to muting their response or trace. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  exception handling  error handling  errors Asked in 1 Companies intermediate Q104. Write Java code that would cause deadlock ? Core Java
Ans. https://howtodoinjava.com/java/multi-threading/writing-a-deadlock-and-resolving-in-java/ Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  multithreading  threads  deadlock Asked in 1 Companies intermediate Q105. Can we use Prototype Bean scope with Autowiring ? Spring
Ans. Default Bean scope in auto wiring is Singleton but Yes, that can be changed by specifying the Bean scope explicitly. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  spring boot   spring mvc  autowiring  bean scope   prototype bean scope intermediate Q106. How many VTables are there for each class ? Core Java
Ans. There is one VTable for each class. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  virtual table method  vtable  runtime polymorphism  object oriented programming (oops)  oops concepts   method overriding intermediate   rare Q107. What are the different ways to avoid multi Threading related problems in Java ? Core Java
Ans. Synchronization,
Concurrent classes,
Volatile keyword,
Implementing concurrent Lock interface,
Immutable classes Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  multithreading  threads  ways to avoid thread related problems  synchronization  volatile  concurrent collections Intermediate