Home » Author Archives: Pankaj Kumar (page 2)

Author Archives: Pankaj Kumar

Mediator Design Pattern in Java – Example Tutorial

java-logo

Mediator Pattern is one of the behavioral design pattern, so it deals with the behaviors of objects. Mediator design pattern is used to provide a centralized communication medium between different objects in a system. According to GoF, mediator pattern intent is: Allows loose coupling by encapsulating the way disparate sets of objects interact and communicate with each other. Allows for ...

Read More »

Memento Design Pattern in Java – Example Tutorial

java-logo

Memento pattern is one of the behavioral design pattern. Memento design pattern is used when we want to save the state of an object so that we can restore later on. Memento pattern is used to implement this in such a way that the saved state data of the object is not accessible outside of the object, this protects the ...

Read More »

Observer Design Pattern in Java – Example Tutorial

java-logo

Observer pattern is one of the behavioral design pattern. Observer design pattern is useful when you are interested in the state of an object and want to get notified whenever there is any change. In observer pattern, the object that watch on the state of another object are called Observer and the object that is being watched is called Subject. ...

Read More »

Iterator Design Pattern in Java – Example Tutorial

java-logo

Iterator pattern in one of the behavioral pattern and it’s used to provide a standard way to traverse through a group of Objects. Iterator pattern is widely used in Java Collection Framework where Iterator interface provides methods for traversing through a collection. According to GoF, iterator design pattern intent is: Provides a way to access the elements of an aggregate ...

Read More »

Java Exception Handling Tutorial with Examples and Best Practices

java-logo

Exception is an error event that can happen during the execution of a program and disrupts its normal flow. Java provides a robust and object oriented way to handle exception scenarios, known as Java Exception Handling. We will look into following topics in this tutorial.               Java Exception Handling Overview Exception Handling Keywords Exception ...

Read More »

Java FutureTask Example Program

java-logo

Sometime back I wrote a post about Java Callable Future interfaces that we can use to get the concurrent processing benefits of threads as well as they are capable of returning value to the calling program. FutureTask is base concrete implementation of Future interface and provides asynchronous processing. It contains the methods to start and cancel a task and also ...

Read More »

Java Priority Queue (PriorityQueue) Example

java-logo

We know that Queue follows First-In-First-Out model but sometimes we need to process the objects in the queue based on the priority. For example, let’s say we have an application that generates stocks reports for daily trading session and it processes a lot of data and takes time to process it. So customers are sending request to the application that ...

Read More »

40 Java Collections Interview Questions and Answers

java-logo

Java Collections Framework are the fundamental aspect of java programming language. It’s one of the important topic for java interview questions. Here I am listing some important questions and answers for java collections framework.                 Tip Are you looking for career opportunities in Java?   Visit our Job Board to search and review ...

Read More »

Java Thread Pool Example using Executors and ThreadPoolExecutor

java-logo

A thread pool manages the pool of worker threads, it contains a queue that keeps tasks waiting to get executed. A thread pool manages the collection of Runnable threads and worker threads execute Runnable from the queue. java.util.concurrent.Executors provide implementation of java.util.concurrent.Executor interface to create the thread pool in java. Let’s write a simple program to explain it’s working.   ...

Read More »
Do you want to know how to develop your skillset and become a ...

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!
Get ready to Rock!
To download the books, please verify your email address by following the instructions found on the email we just sent you.

THANK YOU!

Close