Java Interview Questions - Design

Here are the most popular Java interview questions about design.

See all questions

Should you use external libraries in your code? What are the benefits and drawbacks? What precautions can be taken?

External libraries are extremely helpful when writing large and complex programs - they save the effort of having to code something which has already been implemented by someone else.


Describe a potential way of creating a memory leak in Java. Give an example.

Because Java has automated memory management, it precludes code errors relating to allocation of memory for objects and reclaiming memory from objects. This prevents user errors arising due to incorrect code for memory management, but it does not avoid design flaws that can result in memory leaks.

Example of Design flaw:

We are required to implem


Looking for developers?