Blog Archives
1 2

12 Java design patterns interview Q&As

Java Design Patterns Interview Questions Links: Why do Proxy, Decorator, Adapter, Bridge, and Facade design patterns look very similar? What are the differences? | Builder pattern and immutability in Java | Flyweight pattern and improve memory usage & performance | Java ExecutorService with strategy design pattern | Java dynamic proxy...

Members Only Content
Log In Register Home


14: Singleton design pattern in Java & 5 key follow up Interview Q&As

When you are asked in job interviews to explain a design pattern that you had used, many pick “singleton” as it is easy to explain. But, “singleton” design pattern does have lots of nuances that can lead to further drill down questions mentioned in this post. This post also explains...

Members Only Content
Log In Register Home


Builder pattern and immutability in Java

Next time you are asked to explain a design pattern in an interview, you could pick this as opposed to the very common factory and singleton design patterns. Q1. How will you go about using a builder design pattern instead of constructors to create thread-safe immutable objects? … Read more...

Members Only Content
Log In Register Home


Design pattern intents interview Q&A

Q1. Why do Proxy, Decorator, Adapter, Bridge, and Facade design patterns look very similar? A1. Some design patterns do have subtle differences, and it is important to understand the intent of a pattern. Decorator and chain of responsibility may look similar but the intent is different. … Read more ›...

Members Only Content
Log In Register Home


Flyweight design pattern to improve memory usage & performance

Flyweight pattern is about sharing a collection of objects. The flyweight design pattern is a structural pattern used to improve memory usage and performance (i.e. due to shorter and less frequent garbage collections) by creating fewer objects. Instead of creating a large number of objects, we reuse the objects that...

Members Only Content
Log In Register Home


Java ExecutorService with strategy design pattern to execute concurrently & sequentially

Java executor framework for running multi-threaded applications concurrently, sequentially, and with a strategy design pattern to switch between sequential and concurrent execution. 1. Running concurrently The output will be You can see more than 1 thread process 5 tasks concurrently. Try changing the Executors.newCachedThreadPool () to Executors.newFixedThreadPool(3) for max 3...

Members Only Content
Log In Register Home


Proxy design pattern in Java with service retry example

Design pattern: If you are asked to describe or talk about a design pattern, you could mention this dynamic proxy class as a proxy design pattern. Many pick either singleton or factory design pattern. It would be nicer to pick something other than these two common patterns. … Read more...

Members Only Content
Log In Register Home


1 2
Why & What are the benefits

🎯 Why java-success.com?

🎯 What are the benefits of Q&As approach?

Learn by categories such as FAQs – Core Java, Key Area – Low Latency, Core Java – Java 8, JEE – Microservices, Big Data – NoSQL, Architecture – Distributed, Big Data – Spark, etc. Some posts belong to multiple categories.

800+ Java & Big Data Q&As Menu

Top