Introduction To J2EE Interview Questions and Answers
So you have finally found your dream job in J2EE but are wondering how to crack the J2EE Interview and what could be the probable J2EE Interview Questions. Every interview is different and the scope of a job is different too. Keeping this in mind we have designed the most common J2EE Interview Questions and Answers to help you get success in your interview.
Below is the top J2EE Interview Questions that are asked frequently in an interview these Top interview questions are divided into parts which are as follows:
Part 1 – J2EE Interview Questions (Basic)
This first part covers basic J2EE interview questions and answers
1. What is J2EE? Name its components and clients types?
J2EE stands for Java 2 Enterprise edition. Its functionality includes the development of multiple tier web-based applications. This platform consists of a set of services, protocols, and APIs.
1.Client tier components: These are the ones which execute on the client machine
2.Web tier components: These get executed on J2EE server.
3.Business tier components: They get executed on J2EE server
4.Enterprise level system software: They get executed on the EIS server.
J2EE Client types:
3.Java web-enabled clients which use Java web start technology
4.Wireless clients which are based upon Mobile information device Profile popularly known as MIDP technology
2. What is MVC on struts?
The MVC popularly known as Model-View-Controller can be described in detail.
- Model: Model is used to represent the internal workings of the system as a single entity or as a multi Java bean entity
- View: Often, Java views are constructed using JSP (Java Server Pages) technology.
- Controller: This is the processor which focuses on client request receiving and delivering a new set of a user interface as per the request. The primary component in the framework is “ActionServlet” servlet class.
Let us move on the next J2EE Interview Questions.
3. What is ORM and benefits of it?
This is the basic J2EE Interview Questions asked in an interview. ORM stands for object-relational mapping. The objects in a java class are mapped with tables of a relational database using metadata which is used to describe the mapping between database and objects. It transforms the data from one object to another. The benefits include:
Maintainability: This ensures that all the code which is generated from ORM is well tested and correcting the functionality is only something which the developer can do.
- Productivity: It ends up reducing the time for data level access coding using automatic code creation which is based on a defined data model tools
- Performance: The code which is generated from the ORM is used to manage the data access needs of the application. We do not need to create any data access code and the one which is present is optimized to speed up the data access process
- Vendor independence: The code generated from ORM is independent on the vendor. This is done to increase the portability of the application.
4.Explain important methods such as save(), Saveorupdate(), load(), get()?
The save() method is used in hibernate which is used to store the object in the database. The check for duplicate records is also put before it is inserted.
Save or update() on the other hand is used to update the object using an identifier. Once the identifier value is NULL, then directly the method save() can be called.
When the object is not available in both cache and database, the load() throws an exception. It returns no null value.
When the object is not available in either database or cache, get() is used which then returns a null value.
5. What is Spring? Explain its advantages and the benefits of the spring framework?
Spring is an open-source Java-based application which aims at reducing the complexity of enterprise application development. It is based out of inversion controlling or dependency injection design patterns.
Advantages of using Spring for application development are as follows:
- Creation of POJOs (Plain Old Java Objects) is done which then facilitates development to reuse existing components.
- It is possible to reduce the development cost by improvising upon the productivity of application development.
- Dependency injection improves the testability of the application.
- Used to improve maintainability with reduced code coupling.
- The need to have an application server is minimized and it works on enterprise service
Benefits of using Spring framework:
- Spring framework provides the possibility of organizing middle-tier objects in a much efficient way
- Properties initialization is easy
- Easy testing of components
- Lightweight container
- Spring framework provides the possibility of configuring management service in any runtime environment in any architectural layer
Part 2 – J2EE Interview Questions (Advanced)
Let us now have a look at the advanced J2EE Interview Questions.
6. Describe the Servlet?
Servlets are the server-side components which are used to provide a powerful mechanism to create server-side programs. The servlets are available in a design for many protocols. Servlet is also platform independent and server independent. The most commonly used protocol in the servlet is HTTP. A servlet is also a pure Java object.
7. What are the different phases of Servlet life cycle?
The different phases of the servlet life cycle are:
- Class loading phase: web container is used to load the servlet class files (*.class)
- Instantiation phase: The default no-arg constructor is called and the servlet class gets instantiated.
- Initialization phase: The method init() is called in this phase only once in a lifetime of a servlet. Servlet configuration is assigned generally, to the servlet.
- Request handling phase: This is the phase where the servlets spend maximum time. Servlets provide the services to various requests by calling service ().
- Removal phase: Destroy function is used to invoke the servlet destruction. Garbage collection occurs later.
Let us move on the next J2EE Interview Questions.
8. What are the different types of JSP tags?
There are four different types of JSP tags:
9. Explain the basic and subtypes of EJBs?
This is the advanced J2EE Interview Questions asked in an interview. Two main types and subtypes of EJBs are:
- Stateful session beans
- Stateless session beans
- Bean-managed persistence
- Container Managed Persistence
- Message-driven beans
10. What is JSP directive?
It is a mechanism which is used to provide metadata information to web container about a JSP file. Different types of JSP directives are:
- Page directive
- Include directive
- Taglib directive
This has been a guide to List Of J2EE Interview Questions and Answers so that the candidate can crackdown these J2EE Interview Questions easily. Here in this post, we have studied about top J2EE Interview Questions which are often asked in interviews. You may also look at the following articles to learn more –