J2EE is a platform-independent, Java-centric environment from Sun for developing, building and deploying Web-based enterprise applications online. The J2EE platform consists of a set of services, APIs, and protocols that provide the functionality for developing multitiered, Web-based applications.
Java is a general purpose, high-level programming language developed by Sun Microsystems. The Java programming language was developed by a small team of engineers, known as the Green Team, who initiated the language in 1991. The language was originally called OAK, and at the time it was designed for handheld devices and set-top boxes. Oak was unsuccessful and in 1995 Sun changed the name to Java and modified the language to take advantage of the burgeoning World Wide Web.
3.How do you differentiate between Core Java and Enterprise Java?
Core Java is something that provides the API’s like regular expression, String handling, collections. But enterprise java involves writing scalable, secure and per-formant applications which can have large user base.
4.What are the J2EE components used while creating an application?
– The J2EE components consist of the functional unit that is used in the application and all the classes of it are also will get used to communicate with various components.
– The J2EE is having several components like :
- Application clients and applets : These components run on the client side to provide the user interface and easy access to applications.
- Java Servlet and JavaServer Pages technology : These are used on the server side to deal with the web related technology. They provide the web related functionalities and user interfaces so that the client can interact with them.
- Enterprise JavaBeans : These are the components that are used for businesses and they are also implemented and run on the server. These are very useful in providing the core and advanced functionality to the user.
5.What is the purpose of web client in J2EE?
The web client is very important part and it has other two parts that defines the way it functions :
– Dynamic part : That gives the dynamic web pages using various markup languages like XML, HTML, etc. This is the part that is generated by using the web components that run in the web tier. The web browser is required to render the pages.
– Static part : That provides static pages from the server to the client that doesn’t change according to the demands. It remains static all the time and provide the information that is like support information or about us.
– The web client is known as thin client that is a very simple web based client doesn’t do any query, execution of business rules and connecting applications. It provides lightweight operations and provides the security, speed and different services to run the applications on the server.
6.How is applet different from other technologies used in J2EE?
Applets are client application that is small in size and it is included in the web tier. It provides the tools to communicate with the users and allow the drawings to be made by using the graphical interface. The applets are written in Java language. This gets executed on the virtual machine used by the Java and installed on the web browser. The plug in required by the client system for the use of security policy that executes the application in the web browser successfully. The components use API keys for creating the web client programs and run the application on the client side. As, no security is allowed the files are not required on the client system. It presents more modular approach to design the application using applets.
7.What is the purpose of the Application Clients in J2EE?
Application client runs on the client side and provide a way to the user to handle the task that is allowing the user to use the interface. The interface that is provided is graphical and tools are given for the help. The graphical user interface is created using swing and advanced window toolkit from the command line interface. These clients can use the applications directly due to the applications being handled at the business tier. The application client communicates throughout the HTTP connection using the servlet and the Java beans component architecture. The application client also includes various components to manage the overall data flow for the communication purpose between the server and the client.
8.What is the communication process of the application using the Java Beans?
JavaBeans components allow an object to be used to use the instance variables. The instance variables consist of get and set methods that are used on the server side to get the data information from the user and set it in the server. It provides lot of variations and elements can be used for the client tier. The client communicates through the business logic that is being provided by the server to run the applications. The web browser is used to communicate through the server by going through the pages that is being made and the transfer happens from the web tier. The J2EE application uses thin client or thick client that provides the lightweight and heavyweight functionality to the client and keep the load also to minimal on the server as well.
9.Explain the use of containers in J2EE.
Containers acts as an interface between a platform and a component that is at the low level and it provides the functionality that is supported by the component. Application clients get executed first and then the beans. It keeps the beans assembled at one place so that it can be used and deployed using the containers. The application consists of the components that are platform specific so the containers allow them to be bundled at one place and then used in the application just by giving the name and the path. The assembling of the beans requires the configuration settings to be seen for each component that is used inside the J2EE application or just by J2EE.
10.What are the Container settings that are being provided by the J2EE server?
J2EE server supports the customization of the server by providing the services like security, transaction management, Java naming directory and other services that can be used to provide the component based architecture.
There are different types of containers that exist :
Enterprise JavaBeans (EJB) container :
This is the container that manages the execution of the beans used for J2EE applications.
- Web container :
This manages the page execution and other components used by the applications.
- Application client container :
This controls and manages the application level components. These are used by the client and they run on the client side.
- Applet container :
It is used to manage the applets that are executed by the web browser and uses Java plug-in.
11.What are the models provided by the J2EE?
- The Interface that is used to provide remote connectivity to the database and the J2EE provides:
Security model to allow the user to configure the web component to use the resource that can be accessed by the users that are permitted to use it.
- Transaction model allow the user to show the relationship between the methods to allow easy transaction that is treated as the single transaction.
- Lookup services, which allow easy identification of the interfaces to provide multiple naming and the directory services to the application that uses the components and access it.
- Remote connectivity model allow the user to manage the communications that are made at the low level between the clients and the beans. The bean gets created by the client that produces a method for executing an application.
12.What are the difference between composition and inheritance in Java?
Composition – has-a relationship between classes.
Inheritance – is-a relationship between classes.
Composition – Composing object holds a reference to composing classes and hence relationship is loosely bound.
Inheritance – Derived object carries the base class definition in itself and hence its tightly bound.
Composition – Used in Dependency Injection
Inheritance – Used in Runtime Polymorphism
Composition – Single class objects can be composed within multiple classes.
Inheritance – Single class can only inherit 1 Class.
Composition – Its the relationship between objects.
Inheritance – Its the relationship between classes.
13.What are the tools contained in J2EE to help develop an application?
J2EE application creation requires some modules and tools that are created to deliver the archive file.
The archive file is used with any archive manager but it is termed as the standard java archive file (JAR) that consists of the interfaces and components together in one.
It consists of the application and deployment tools to create the EAR file and adding them in the JAR file. The tools that are used:
- Deployment descriptors are used to contain the beans and the files that are related to each using the JAR archive container.
- JAR file using the application client consists of the descriptors, class files and the application related data to be used to create an application.
- WAR file is used to collect all the data at one place and populate it accordingly.
14.What are the tasks performed by J2EE enterprise Bean developer?Enterprise Bean Developer platform uses many services for different components and it is always required that the task has to be mentioned such as:
– JAR file is an important file that consists of all the archived files and is used by the Java itself. It is used to perform the following tasks:
- The source code has to be written and compiled properly.
- The deployment descriptor is used to specify the application that need to run.
- The class files that are of the extension .class file create a bundle and it is being bundled to be used as a single file. It requires the descriptor to be there in the JAR file.
15.What are the tasks performed by J2EE web component developer?
Web Component Developer is related to the web services provided to the client for their use and functionality. The WAR file consists of the web component and performs various tasks on them.
The tasks that are performed as follows:
- Writing and compiling the servlet code that allow the errors and warnings to be removed so that the application can run properly everywhere else.
- HTML and JSP files are written using the servlets as well to allow the application to have the proper functionality that is being required by the client.
- Deployment descriptor specifications are given for the web development environment. It includes the bundled files for the deployment descriptor such as the WAR files and allow the application to run after taking the data from the server and given to the client.
16.What is the procedure for the application assembler used in J2EE?
Application assembler is used to receive the application component from the client in a JAR file and then assembling of the file take place using the J2EE component facilities. Various functionalities are used to assemble the application components.
Assembler is also known as the deployed that is allowed to modify the deployment descriptor. The modification can be performed directly or by using the tool correctly that allow the XML tags to be modified using the graphical user interfaces.
The assembler works as:
- Assembles the JAR and WAR files that is being created already before coming in this phase and turned into the EAR file.
- Deployment descriptor specification is provided by using the J2EE application component.
- Verification of the content is being done by the use of EAR file and using the specification that is being given already.
17.What is the process of deploying and administrating the application?
The application deploying and administrating allow the user to configure and deploy the application components in the J2EE application. The administration of the computing can be done to find out the infrastructure that is being used. The networking resources are also included in this, which allows the server to get the configuration for it and allow the client to request the application that is required. It allows the applications to run in the environment that is provided. The models that are used in this include the transaction control, security control models that allow the specification to be provided for the use of database connection. This allow the communication be done between the different components.
18.What is the procedure to deploy the administrating policies for an application?When the configuration that has to be applied is set then the content that is provided with it is used to resolve the dependencies that are coming from outside and allow user to modify the security setting and assign transactions parameters to make it more secure.
The steps that are involved in installing and configuring the J2EE application requires:
- J2EE application uses EAR file that is added when it is created in the phases before.
- Configuration of the environment is being done by modifying the setting of it that allow the application to compatible with the environment. This is having a descriptor that allows describing the component that is in use.
- The contents of EAR file are verified and specifications are checked to meet the requirements.
- Installation or the deployment of the services takes place in the J2EE application file that is deployed on the server.
19.How is the J2EE API integration being performed?
The J2EE API allows the system and applications to integrate the components that are being provided with it.
It enables this by the following methods and ways:
- The application that is used using the API gets incorporated on all the tiers of the enterprise bean. This follows the unified application model.
- The J2EE API provides the request and response in a simplified manner. This is the mechanism that allows the JSP page and servlet to be represented in an easy way so that it can be implemented on the server.
- It also follows the reliable security model that uses JAAS and it enables the security mechanism to be used with the entire application model.
- It allows easy integration of the APIs using the JAXP that is an XML-based data interchange model which is simplified and added to provide the extra properties and manage them from one place.
- It provides interoperability between the connector and uses the J2EE Connector Architecture in a simplified manner.
- It allows connectivity of the database between many database systems using the JDBC APIs.
20.What are the features that are provided by different components of J2EE?
J2EE provides a reference to all the components that it is using to allow an application deployment tool to be used for various purposes.
The deployment tool is used to assemble, verify, and deploy the J2EE applications.
These tools are used to automate the procedure of writing and compiling a code. The tools can be used using the command line or the graphical user interface.
The interface is used as graphical and allows configuring different components of the J2EE as :
- J2EE applications can be chosen to configure, package and deploy those applications on the server. These provide easy integration properties and can be used to create an API.
- J2EE provides enterprise beans that allow the same operations to be used which is provided in the application part. It also provides the same functionality for the web components, application clients and the resource adaptors that provide resources to the application for execution.
21.What is the procedure to be followed to create a J2EE application?
To create the application in J2EE it requires to have predefined components that need to be used in order to successfully execute the application. The components that are used, enterprise bean, application client and the web component. To build the component it is necessary to create an application. This file name can be given according to the requirement and this will get stored in the EAR file like file-name.ear. The procedure that is followed for this is :
- The tool that is used is the deploy-tool. This can be done by selecting the file and then new and then application in the new.
- The browse option can be selected to select the application that needs to be included.
- Enter the field name and save the file with the name that is entered by the user.
- Save and exit and a new application gets created.
22.What do you understand by the JTA and JTS in reference to J2EE?
JTA (Java Transaction API) :
The JTA is responsible for providing an interface that allows the user to segregate transactions in a way that it does not depend on the transaction manger implementation. The transaction processing monitor is responsible for coordinating the transactions across various resources. Every resource has its own manager. The JTA architecture makes it mandatory for each resource manager to implement the interface so that it can be managed by the TP monitor.
JTS (Java Transaction Service) :
The JTS is used for the implementation of the transaction manager. It is responsible for providing services related to transaction to the various parties involved in distributed transactions. These can be the application server, the communication resource manager or a standalone transactional application.
The JTA can be considered to be a high level transaction interface used by an application to control a transaction whereas the JTS can be considered to be a low level API used in the background processes.
Why is J2EE the choice for distributed multi-tiered Applications?
J2EE is a platform that uses multi-tiered distributed application divided into components that are divided on the basis of function, applications and other components that gets installed with the platform.
There are different parts that are used for this multi-tiered application :
- Client-tier components : This is the component that is used to run on the client machine.
- Web-tier components : They are executed and maintained on a J2EE server.
- Business-tier components : These are also executed and maintained on a J2EE server.
- Enterprise Information System (EIS) : This tire of software executes specifically on EIS servers.
23.How can user package J2EE components?
The J2EE components of an application are packaged separately and then are bundled into a J2EE application. All the related files of a component such as the html, server utility classes etc. are clubbed together along with a deployment descriptor and assembled into a module. This module can be added to a J2EE application. The deployment descriptor is made using an xml file and it defines a components deployment settings. A J2EE application comprises of one or multiple enterprise bean, web or client component modules. Every J2EE application and the modules that make it have their own deployment descriptor file. Depending upon the design requirements the final enterprise solution may consist of one or more J2EE applications.
24.Difference between == and .equals() ?
“equals” is the method of object class which is supposed to be overridden to check object equality, whereas “==” operator evaluate to see if the object handlers on the left and right are pointing to the same object in memory.
x.equals(y) means the references x and y are holding objects that are equal. x==y means that the references x and y have same object.
String x = new String(“str”);
String y = new String(“str”);
System.out.println(x == y); // prints false
System.out.println(x.equals(y)); // prints true
25.Explain the scenerios to choose between String , StringBuilder and StringBuffer ?
If the Object value will not change, use String Class because a String object is immutable.
If the Object value can change and will only be modified from a single thread, use StringBuilder because StringBuilder is unsynchronized(means faster).
If the Object value may change, and can be modified by multiple threads, use a StringBuffer because StringBuffer is thread safe(synchronized).
You may be interested in
- Java Interview Questions
- Java Interview Questions and Answers
- Java Web Services Interview Questions
- Java Collections Interview Question and Answers
- Multithreading in Java Interview Questions and answers
- Tricky Java Interview Questions and Answers
- Interview Questions For Selenium with Java
- Core Java Interview Questions
- Core Java Programming Interview Questions and Answers
- Spring Boot Interview Questions and Answers
- Spring Interview Questions and Answers for Experienced
- Spring mvc interview questions
- Spring MVC Interview Questions and Answers For Experienced
- Spring Interview Questions
- Spring AOP Interview Questions and Answers
- API Interview Questions And Answers
- Restful Web Services Interview Questions and Answers
- Hibernate Interview Questions
- Best Hibernate Interview Questions and Answers 2018
- Hibernate Interview Questions and Answers For Experienced
- JSP Interview Questions
- JBOSS Interview Questions and Answers
- J2EE Interview Questions and Answers