Top 40 Popular J2EE Interview Questions and Answers You Should Read

J2EE Interview Questions:

J2EE stands for Java 2 Platform Enterprise Edition. It is an open and standard-based platform for development, deployment, and management of multi-tier, web-enabled, component based and server centric enterprise applications.

There are several Application programming interfaces comprised with J2EE for a build such systems.

This document focuses on the understanding of J2EE concepts, theories, and some common coding techniques.

Most Popular J2EE Interview Questions And Answers

j2ee interview questions

These J2EE questions would be helpful for experienced professionals as well.

Here we go.

Q #1) What are the components of J2EE applications?

  • Client-tier components. Run on the client machine.
  • Web tier components. Run on the J2EE server.
  • Business tier components. Run on the J2EE server.
  • Enterprise information system software (EIS software).Runs on the EIS server.

Q #2) What are the J2EE client types?

  • Applets
  • Application clients
  • Java Web Start enabled clients, by Java Web Start technology.
  • Wireless clients, based on Mobile Information Device Profile (MIDP) technology.

Q #3) What is a J2EE container?

Ans) The interface between a component and the low-level platform with specific functionality that support the component is called a container. Application server maintains control and provides relevant services through an interface or framework calls as a container.

Q #4) What are defined as web components?

Ans) Java Servlets and Java server pages technology components are identified as web components. Servlets dynamically receive requests and make responses. JSP server pages also behave as Java Servlets but facilitate to create more static contents.

Q #5) Describe the MVC on struts?

Ans) MVC stands for Model View Controller. Each section in Model View Controller can describe as follows.

  • Model –Model represents the internal state of the system as a set of single or many Java Beans.
  • View – Most often view is a constructed using Java Server Pages (JSP) technology.
  • Controller –The controller is the process that focuses on client request receiving and produce next level of a user interface according to the request. The primary component of the controller in the framework is “ActionServlet” servlet class.

Q #6) Define JSF?

Ans) JSF stands for Java Server Faces. It is the user interface (UI) designing framework for Java Web Applications developments. There are set of reusable UI components associated with JSF. Also, JSF based on Model-View-Controller (MVC) design concepts and patterns. The automated data saving process from form to server and display at client side is also handling by JSF.

Q #7) What is Hashtable?

Ans) Hash table is a Collection Synchronized objects. It allows Null values but not duplicate values. Hash table is like a HashMap.

Q #8) Define Hibernate?

Ans) Hibernate is an open source object-relational mapping and query service which facilitate to write Hibernate Query Language (HQL) scripts instead of Structured Query Language (SQL) scripts. It is faster and easy than writing native SQL. Hibernate has more powerful object oriented contents like associations, inheritance, and polymorphism. Also, Hibernate has a powerful composition and collections. Hibernate allows making queries using Java base approach.

Q #9) What are the identified limitation of hibernate?

Ans)

  • Slower in action – In execution of HQL queries take more time than it executes directly.
  • Only composite keys support available and it prevents advanced query options.
  • No shared value type references available.

Q #10) What the identified advantages are of hibernate?

Ans)

  • Database and vendor independence application.
  • Standard Object-relational mapping support.
  • Domain object mapping for a relational database.
  • Better performance than Java Database Connectivity.
  • Java Persistence API based applications.

Q #11) Describe ORM?.

Ans) Object-Relational mapping (ORM) can describe as follows.

The mapped objects in a Java class to the tables of the relational database using metadata which describes the database and object mapping. The working method is to transform data from one representation to another.

Q #12) What are the advantages of Object-Relational mapping (ORM)?

Ans)

  • Productivity – Reduce the time for data access coding with help of automatic code creation base on the defined data model.
  • Maintainability – All code generated from ORM are well tested. Only the developer need to create the correct functionality
  • Performance – The code generated from ORM completely manages the data access needs of the application. No need to create any data access code to create and also the code is optimized for speed up the data access process.
  • Vendor independence – The code generated from ORM is not depending on the vendor. This is to increase the portability of the application.

Q #13) What is the use of method save()?

Ans) In hibernate this method is used to stores an object into the database. There is a check for duplicate records before inserting it.

Q #14) What is the use of method saveorupdate()?

Ans) In hibernate this method is used to update an object using identifier. When the value for the identifier is NULL then the method direct to call save().

Q #15) What is the difference between load() and get()?

Ans) When the object not available in either cache or database, load() thrown an exception. No null return from load().

When the object not available in either cache or database, get() returns null.

Q #16) What is mean by connection pooling?

Ans) Simply connection pooling is a mechanism to re-use the existing connections. The pooling mechanism maintains a number of already created object connections and when there is a demand the mechanism directly use existing connection without creating a new one.

Q #17) Define the Collection types in Hibernate?

Ans) One-to-many reference is defined as a collection. There are five main collection types associated with J2EE.They are

Set type, List type, Array type, Map type, Bag type

Q #18) Define thin client?

Ans) A program interface that does not have any operations like database queries, complex business rules or any connection to the third-party application is called a thin client.

Q #19) Describe the file types *.ear, * .jar and *.war?

Ans)

  • *.jar files – Property file contains libraries, resources and accessories are included with the *.jar file extension.
  • *.war files – The files that need to development of web application (HTML, java scripts, JSP) included with a *.war file extension.
  • *.ear files – The files for Enterprise Java Beans modules for the application is save as *.ear files.

Q #20) What spring is in related to J2EE?

Ans) Spring is an open source application that reduces the complexity of enterprise application development. Spring is based on an inversion of control or dependency injection design patterns.


Q #21) What are the advantages in the use of spring for application development?

Ans)

  • Plain Old Java Object (POJO) based development facilitates to re-use existing components.
  • Possible to reduce development cost by improving the productivity of the application development.
  • Improve the testability of application with dependency injection.
  • Improve maintainability with reduce code coupling.
  • No need to have an application server and works on enterprise service.

Q #22) Discuss the benefit of Spring Framework?

Ans)

  • Possibility to organize middle tier objects in an efficient way.
  • Easy initialization for properties.
  • Easily testable components.
  • Lightweight container.
  • Possibilities to use configure management service of spring in any runtime environment with whatever architectural layer.

Q #23) Describe servlet?

Ans) Server side component that provides a powerful mechanism to create server side programs is called a servlet. There are servlets available with a design for various protocols. Servlet is also server and platform independent. Most commonly use protocol for the servlet is Hypertext Transfer Protocol (HTTP).Also, a servlet is a pure java object.

Q #24) Describe the phases of servlet lifecycle?

Ans)

  • Class loading phase – Web container loads the servlet class file (*.class).
  • Instantiation phase – By calling default no-arg constructor the servlet class gets Instantiated.
  • Initialize phase – The method Init () called in this phase in only one time of the lifetime of a servlet. Servlet configuration is assigned to the servlet.
  • Request Handling phase – In this phase, only servlets spends most of the time. Servlet provides the services to various requests by calling Service ().
  • Removal phase – The destroy () function calls before servlet destruction. Garbage collection occurs later.

Q  #25) What are the difference types of JSP tags?

Ans) There are 4 different types of tags associated with JSP.They are mentioned below

  • Directives
  • Declarations
  • Scriplets
  • Expressions

Q #26) Describe action form?

Ans) A java bean that is associated with single or multiple action mapping is called action form. Action form objects are automatically populated at server end when data has been enter from the client from a user interface (UI).

Session states of a web application are maintained by action forms.

Q #27) Describe Secure Socket Layer (SSL)?

Ans) The technology that use to communicate between the web server and the web browser is called Secure Socket Layer (SSL).More especially SSL is a protocol that describes how algorithms to be used in encryption. The technology established an encrypted link between two parties and this link is allowed to secure transmission of sensitive information such as login credentials, credit/debit card information and social security numbers.

Q #28) What id URL?

Ans) URL stands for Uniform Resource Locator and it is the textual reference writing standard to an arbitrary piece of data in the World Wide Web (WWW).The general structure of URL is as follows.

protocol://host/local info

  • protocol -> Protocol for fetching the object ( eg – HTTP, FTP)
  • host -> Internet name of the targeted host.
  • local info -> String passed to the protocol handler on the remote host. In many cases, it is a file name with extension.

Q #29) What is URN?

Ans) URN stands for Uniform resource name. It is the unique identifier that identified an entity. But the information of where the entity is located is not available.

Q #30) What are the phases of a servlet life cycle?

Ans) Following steps are associated with servlet life cycle.

  • Loading of the servlet class.
  • Instantiation of Servlet.
  • Execution of init method.
  • Request handling phase. In this phase service methods will call.
  • Removal from service phase. In this phase destroy method will call.

Q #31) Is that Servlet is pure java object or not?

Ans) Yes, Servlet is pure java object.

Q #32) What is EJB?

Ans) EJB stands for Enterprise Java Beans. It is the server side components that executes in EJB container and encapsulates the business logic for the enterprise application.

Q #33) What are the system services of EJB container?

Ans) EJB Container provides following system services.

  • Persistence
  • Security
  • Transaction
  • Connection pooling
  • Component lifecycle management
  • Threading

Q #34) What are the design principles for EJB?

Ans)

  • Behavior of the EJB application is specified by interfaces
  • EJB applications are loosely coupled and tired.
  • Implementation is hidden from the client side.
  • The EJB container supports the application developer.
  • The API to the application is in session tier.
  • The API to the data sources is in entity tier.

Q #35) What are the advantages of EJB components?

Ans)

  • There is a support for the integration of components from different vendors.
  • Possibility authored EJB components detailed knowledge of the environment.
  • Possibility to assembled applications from separate components source.
  • Interaction with its clients is entirely specified in terms of java interfaces.
  • Portability support.
  • Does not maintain resources.

Q #36) What are the Basic and subtypes of Enterprise Java Beans (EJB)?

Ans) Two main types and subtypes of EJB are as follows.

  • Session Beans
    • Stateful session beans
    • Stateless session beans
  • Entity Beans
    • Bean Managed Persistence (BMP)
    • Container Managed Persistence (CMP)
    • Message Driven Beans

Q #37) What is the description for expression element?

Ans) The expressions that use to write dynamic content back to the client browser are called expression elements.

Q #38) What are the two types of comments supported by JSP?

Ans) There are two types of comments are supported by JSP.

  • HTML comment.

HTML comment

  • JSP comment.

JSP comment

Q #39) What is called JSP directive?

Ans) JSP directive is the mechanism to provide Metadata information to web container about JSP file. In the translation and compilation phases of the JSP life cycle, these Metadata use by the web container.

Q #40) What are the different types of JSP directive?

Ans) There are 3 different types of JSP directives available.

  • Page directive
  • Include directive
  • Taglib directive

Conclusion

The above list contains frequently asked J2EE Interview Questions with best descriptive answers on different J2EE concepts like JSP, Servlet, EJB and spring. The document can use to fresher’s as well as 2-6 years’ experience programmers to have a quick guide in specific questions.