Home » Author Archives: Pankaj Kumar

Author Archives: Pankaj Kumar

Struts2 Interview Questions and Answers

apache-struts-logo

Struts2 is one of the famous framework for developing web application in java. Recently I have wrote a lot of Struts2 Tutorials and in this post, I am listing down some of the important Struts2 interview questions with answers to help you in interview.                 What is Struts2? What are the differences between ...

Read More »

Servlet Exception and Error Handling Example Tutorial

java-interview-questions-answers

Sometime back I wrote a post about Exception Handling in Java but when it comes to web application, we need more than normal exception handling in java. Servlet Exception If you notice, doGet() and doPost() methods throw ServletException and IOException, let’s see what happens when we throw these exception from our application. I will write a simple servlet that will ...

Read More »

50 Servlet Interview Questions and Answers

java-interview-questions-answers

Servlets are very important topic of Java EE and all of the web applications framework such as Spring and Struts are built on top of it. This makes servlet a hot topic in Java interviews. Here I am providing a list of 50 servlet interview questions with answers to help you tackle most of the interview questions related to servlets ...

Read More »

Async Servlet Feature of Servlet 3

java-interview-questions-answers

Before we jump into understanding what Async Servlet is, let’s try to understand why do we need it. Let’s say we have a Servlet that takes a lot of time to process, something like below.                 LongRunningServlet.java package com.journaldev.servlet; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; ...

Read More »

Servlet Upload File and Download File Example

java-interview-questions-answers

File Upload and Download and common tasks in a java web application. Since I have written a lot about java servlet recently, I thought to provide a sample example of file upload and download using servlet. Use Case Our use case is to provide a simple HTML page where client can select a local file to be uploaded to server. ...

Read More »

State Design Pattern in Java – Example Tutorial

java-logo

State pattern is one of the behavioral design pattern. State design pattern is used when an Object change it’s behavior based on it’s internal state. If we have to change the behavior of an object based on it’s state, we can have a state variable in the Object and use if-else condition block to perform different actions based on the ...

Read More »

Strategy Design Pattern in Java – Example Tutorial

java-logo

Strategy pattern is one of the behavioral design pattern. Strategy pattern is used when we have multiple algorithm for a specific task and client decides the actual implementation to be used at runtime. Strategy pattern is also known as Policy Pattern. We defines multiple algorithms and let client application pass the algorithm to be used as a parameter. One of ...

Read More »

Template Method Design Pattern in Java

java-logo

Template Method is a behavioral design pattern and it’s used to create a method stub and deferring some of the steps of implementation to the subclasses. Template method defines the steps to execute an algorithm and it can provide default implementation that might be common for all or some of the subclasses. Let’s understand this pattern with an example, suppose ...

Read More »

Visitor Design Pattern in Java – Example Tutorial

java-logo

Visitor Pattern is one of the behavioral design pattern. Visitor pattern is used when we have to perform an operation on a group of similar kind of Objects. With the help of visitor pattern, we can move the operational logic from the objects to another class. For example, think of a Shopping cart where we can add different type of ...

Read More »

Multiple Inheritance in Java and Composition vs Inheritance

java-logo

Sometime back I wrote few posts about inheritance, interface and composition in java. In this post, we will look into multiple inheritance and then learn about benefits of composition over inheritance. Multiple Inheritance in Java Multiple inheritance is the capability of creating a single class with multiple superclasses. Unlike some other popular object oriented programming languages like C++, java doesn’t ...

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