SlideShare a Scribd company logo
JAVA Interview Questions Part-2
JAVA J2EE Training
51. What are considered as a web component?
Java Servlet and Java Server Pages technology components are web components.
Servlets are Java programming language that dynamically receive requests and
make responses. JSP pages execute as servlets but allow a more natural approach
to creating static content.
52. Define Hash table?
Hash Table is just like Hash Map or Collection having unique key value pairs. Hash
table is a collection of Synchronized object. It does not allow duplicate values but it
allows null values.
53. What is Hibernate?
Hibernate is a open source object-relational mapping and query service. In
hibernate we can write HQL instead of SQL which save developers to spend more
time on writing the native SQL. Hibernate has more powerful association,
inheritance, polymorphism, composition, and collections. It is a beautiful approach
for persisting into database using the java objects. Hibernate also allows you to
express queries using java-based criteria.
54. What is ORM?
ORM stands for Object-Relational mapping. The objects in a Java class which is
mapped in to the tables of a relational database using the metadata that describes
the mapping between the objects and the database. It works by transforming the
data from one representation to another.
55. Difference between Proxy and Adapter?
Adapter object has a different input than the real subject whereas Proxy object has
the same input as the real subject. Proxy object is such that it should be placed as
it is in place of the real subject.
56. What is MVC?
Model-View-Controller is a design pattern wherein Model holds the business logic
, Controller controls the flow and View takes care of the presentation part of web
application.
57. What is dependency injection or IOC?
It's a mechanism of passing object creation to an external component wherein
dependent objects are identified and created using configuration.
58. What is bean auto wiring?
The Spring container is able to auto wire relationships between collaborating
beans. This means that it is possible to automatically let Spring resolve
collaborators (other beans) for your bean by inspecting the contents of the
BeanFactory without using <constructor-arg> and <property> element.
59. What are the different types of IOC (dependency injection)?
Constructor Injection (e.g. Pico container, Spring etc): Dependencies are provided
as constructor parameters.
Setter Injection (e.g. Spring): Dependencies are assigned through JavaBeans
properties (ex: setter methods).
Interface Injection (e.g. Avalon): Injection is done through an interface.
Note: Spring supports only Constructor and Setter Injection
60. What are the advantages of Spring framework?
The advantages of Spring are as follows:
Spring has layered architecture. Use what you need and leave you don't need now.
Spring Enables POJO Programming. There is no behind the scene magic here. POJO
programming enables continuous integration and testability.
Dependency Injection and Inversion of Control Simplifies JDBC
Open source and no vendor lock-in.
61. What are the common implementations of the Application Context?
The three commonly used implementation of 'Application Context' are,
ClassPathXmlApplicationContext : It Loads context definition from an XML file
located in the classpath, treating context definitions as classpath resources. The
application context is loaded from the application's classpath by using the code.
ApplicationContext context = new ClassPathXmlApplicationContext("bean.xml");
FileSystemXmlApplicationContext : It loads context definition from an XML file in
the filesystem. The application context is loaded from the file system by using the
code.
ApplicationContext context = new FileSystemXmlApplicationContext("bean.xml");
XmlWebApplicationContext : It loads context definition from an XML file
contained within a web application.
62. What is DelegatingVariableResolver?
Spring provides a custom JavaServer Faces VariableResolver implementation that
extends the standard Java Server Faces managed beans mechanism which lets you
use JSF and Spring together. This variable resolver is called
as DelegatingVariableResolver.
63. What is Significance of JSF- Spring integration?
Spring - JSF integration is useful when an event handler wishes to explicitly invoke
the bean factory to create beans on demand, such as a bean that encapsulates the
business logic to be performed when a submit button is pressed.
64. What are the ways to access Hibernate using Spring?
There are two approaches to Spring’s Hibernate integration:
Inversion of Control with a HibernateTemplate and Callback
Extending HibernateDaoSupport and Applying an AOP Interceptor.
65. How the AOP used in Spring?
AOP is used in the Spring Framework: To provide declarative enterprise services,
especially as a replacement for EJB declarative services. The most important such
service is declarative transaction management, which builds on the Spring
Framework's transaction abstraction. To allow users to implement custom aspects,
complementing their use of OOP with AOP.
66. What is Session Tracking?
Session simply means a particular interval of time.
Session Tracking is a way to maintain state of an user. Http protocol is a stateless
protocol. Each time user requests to the server, server treats the request as the
new request. So we need to maintain the state of a user to recognize to particular
user.
67. How is a typical spring implementation look like?
For a typical Spring Application we need the following files:
An interface that defines the functions.
An Implementation that contains properties, its setter and getter methods,
functions etc., Spring AOP (Aspect Oriented Programming)
A XML file called spring configuration file.
Client program that uses the function.
68. What is Java Server Faces (JSF) - spring integration mechanism?
Spring provides a custom JavaServer Faces VariableResolver implementation that
extends the standard JavaServer Faces managed beans mechanism. When asked to
resolve a variable name, the following algorithm is performed.
69. What is Significance of JSF- Spring integration?
Spring - JSF integration is useful when an event handler wishes to explicitly invoke
the bean factory to create beans on demand, such as a bean that encapsulates the
business logic to be performed when a submit button is pressed.
70. How to integrate your Struts application with spring?
To integrate your Struts application with spring, we have two options:
Configure spring to manage your Actions as beans, using the ContextLoaderPlugin,
and set their dependencies in a spring context file.
Subclass Spring's ActionSupport classes and grab your Spring-managed beans
explicitly using a getWebApplicationContext() method.
71. How to integrate spring and Hibernate?
Spring and Hibernate can integrate using spring’s SessionFactory called
LocalSessionFactory. The integration process is of 3 steps.
Configure Hibernate mappings.
Configure Hibernate properties.
Wire dependant object to SessionFactory.
72. What are the ways to access Hibernate using Spring?
There are two ways to access Hibernate from Spring:
Through Hibernate Template.
Subclassing HibernateDaoSupport
Extending HibernateDaoSupport and Applying an AOP Interceptor
73. Why most users of the Spring Framework choose declarative transaction
management?
Most users of the Spring Framework choose declarative transaction management
because it is the option with the least impact on application code, and hence is
most consistent with the ideals of a non-invasive lightweight container.
74. When to use programmatic and declarative transaction management?
Programmatic transaction management is usually a good idea only if you have a
small number of transactional operations.
On the other hand, if your application has numerous transactional operations,
declarative transaction management is usually worthwhile. It keeps transaction
management out of business logic, and is not difficult to configure.
75. Explain about the Spring DAO support?
The Data Access Object (DAO) support in Spring is aimed at making it easy to work
with data access technologies like JDBC, Hibernate or JDO in a consistent way. This
allows one to switch between the persistence technologies fairly easily and it also
allows one to code without worrying about catching exceptions that are specific to
each technology.
76.What are the exceptions thrown by the Spring DAO classes?
Spring DAO classes throw exceptions which are subclasses of
DataAccessException(org.springframework.dao.DataAccessException).Spring
provides a convenient translation from technology-specific exceptions like
SQLException to its own exception class hierarchy with the DataAccessException as
the root exception. These exceptions wrap the original exception.
77. What is SQLExceptionTranslator?
SQLExceptionTranslator, is an interface to be implemented by classes that can
translate between SQLExceptions and Spring's own data-access-strategy-agnostic
org.springframework.dao.DataAccessException.
78. What is Spring's JdbcTemplate ?
Spring's JdbcTemplate is central class to interact with a database through
JDBC. JdbcTemplate provides many convenience methods for doing things such as
converting database data into primitives or objects, executing prepared and
callable statements, and providing custom database error handling.
JdbcTemplate template = new JdbcTemplate(myDataSource);
79. What is PreparedStatementCreator ?
PreparedStatementCreator:
Is one of the most commonly used interfaces for writing data to database.
Has one method – createPreparedStatement(Connection)
Responsible for creating a PreparedStatement.
Does not need to handle SQLExceptions.
80. What is Application Context?
A bean factory is fine to simple applications, but to take advantage of the full
power of the Spring framework, you may want to move up to Springs more
advanced container, the application context. On the surface, an application context
is same as a bean factory.Both load bean definitions, wire beans together, and
dispense beans upon request. But it also provides:
* A means for resolving text messages, including support for internationalization.
* A generic way to load file resources.
* Events to beans that are registered as listeners.
81. What are the types of Dependency Injection Spring supports?
Setter Injection: Setter-based DI is realized by calling setter methods on your
beans after invoking a no-argument constructor or no-argument static factory
method to instantiate your bean.
Constructor Injection: Constructor-based DI is realized by invoking a constructor
with a number of arguments, each representing a collaborator.
82. What are the exceptions thrown by the Spring DAO classes ?
Spring DAO classes throw exceptions which are subclasses of
DataAccessException(org.springframework.dao.DataAccessException).Spring
provides a convenient translation from technology-specific exceptions like
SQLException to its own exception class hierarchy with the DataAccessException as
the root exception. These exceptions wrap the original exception.
83. What is Spring's JdbcTemplate ?
Spring's JdbcTemplate is central class to interact with a database through JDBC.
JdbcTemplate provides many convenience methods for doing things such as
converting database data into primitives or objects, executing prepared and
callable statements, and providing custom database error handling.
JdbcTemplate template = new JdbcTemplate (myDataSource);
84. Explain the three different methods which are provided by the Namespace
Handler interface?
The three different methods which are provided by the name space handler
interface are:
1) Init() is used to allow initialization for name space handler.
2) BeanDefinition parse is used when a Spring encounters a top level element.
3) BeanDefinitionHandler is used when spring encounters an attribute.
85. Which of the beans available in EJB 3 are only called by clients ?
Session and Singleton (EJB 3.1) beans are the ones who encapsulate the business
logic which is why it is the only bean which is called by clients. Other beans like
MDB and Entity beans are called by session and singleton beans to complete the
business requirement.
86. Why is it so to make the session beans into two parts one with interface and
the other as implementation to the interface? Or why session beans should be
used through business interface? (EJB 3.0 Specific).
This approach promotes loose coupling since implementation classes can easily be
swapped out without a lot of code changes. But in recent EJB 3.1 specification you
don't need to implement a business interface for faster development.
87. What is business interface?
An interface through which a client invokes the bean is called a business
interface. There are three types of business interfaces available in EJB 3 : Local,
Remote and WebService
88. Can we have instance fields in Stateless session bean?
Yes. A stateless session bean can have instance field, BUT not for storing state
information as opposed to Stateful beans. There may be a need of storing certain
shareable resources like data source, JMS source etc, which will be used in the
exposed method. So it is perfectly safe to have instance fields in the Stateless
session beans.
89. Can you inject Stateful beans into stateless session bean or Servlet?
Yes!!. Nobody stops you to inject Stateful beans into stateless session bean or a
Servlet. Let’s take a Servlet and inject (definitely as a field in Servlet) a Stateful
bean; What happens? Container creates a single instance of a Servlet, so the
instance field of Servlet ( which is a Stateful Bean ) injected , is shared among
clients.It will lead to drastic data inconsistency ( stored in Stateful bean ) being
shared by clients. And this is no different for a Stateful bean injected into stateless
bean. So you must AVOID injecting into stateless beans and Servlets. Please don't
ask how do you access or make use of Stateful bean in Stateless or Servlet.The
answer is JNDI inside the methods of Stateless and doGet() or doPost() of Servlet.
90. What are Pull-MVC and push-MVC based architecture ? Whicharchitecture
does Struts2 follow?
Pull-MVC and Push-MVC are better understood with how the view layer is getting
data i.e. Model to render. In case of Push-MVC the data( Model) is constructed and
given to the view layer by the Controllers by putting it in the scoped variables like
request or session. Typical example is Spring MVC and Struts1. Pull-MVC on the
other hand puts the model data typically constructed in Controllers are kept in a
common place i.e. in actions, which then gets rendered by view layer. Struts2 is a
Pull-MVC based architecture, in which all data is stored in Value Stack and
retrieved by view layer for rendering.
91. Are Interceptors in Struts2 thread safe?
No, Unlike Struts2 action, Interceptors are shared between requests, so thread
issues will come if not taken care of
92. Are Interceptors and Filters different? , If yes then how?
Apart from the fact that both Interceptors and filters are based on intercepting
filter,there are few differences when it comes to Struts2.
Filters: (1)Based on Servlet Specification (2)Executes on the pattern matches on
the request.(3) Not configurable method calls
Interceptors: (1)Based on Struts2. (2)Executes for all the request qualifies for a
front controller( A Servlet filter ).And can be configured to execute additional
interceptor for a particular action execution.(3)Methods in the Interceptors can be
configured whether to execute or not by means of excludemethods or
includeMethods. ( see tutorial on this Controlling Interceptor Behavior)
93. Which class is the front-controller in Struts2?
The class "org.apache.struts2.dispatcher.FilterDispatcher " is the front controller in
Struts2. In recent time Struts 2.1.3 this class is deprecated and new classes are
introduced to do the job.
94. What is the role of Action/ Model?
Actions in Struts are POJO, is also considered as a Model. The role of Action are to
execute business logic or delegate call to business logic by the means of action
methods which is mapped to request and contains business data to be used by the
view layer by means of setters and getters inside the Action class and finally helps
the framework decide which result to render.
95. What is the relation between ValueStack and OGNL?
A ValueStack is a place where all the data related to action and the action itself is
stored. OGNL is a mean through which the data in the ValueStack is manipulated.
96. What is the difference between Action and ActionSupport?
Action is interface defines some string like SUCCESS,ERROR etc and an execute()
method. For convenience Developer implement this interface to have access to
String field in action methods. ActionSupport on other hand implements Action
and some other interfaces and provides some feature like data validation and
localized error messaging when extended in the action classes by developers
97. Who loads the struts.xml file? Which Struts2 API loads the struts.xml file?
In Struts2 FilterServlet is the responsible class for loading struts.xml file as we
deploy the application on the container. Unlike Servlet (as with Struts1) needs
the load-on-startup tag to load the front controller,a filter doesn't need to have
load on startup tag to be loaded as the application is deployed. As with servlet
specification a filter is loaded/executed as the application starts up.
98. What is JDBC Driver interface?
The JDBC Driver interface provides vendor-specific implementations of the
abstract classes provided by the JDBC API. Each vendor driver must provide
implementations of the java.sql.Connection, Statement, PreparedStatement,
CallableStatement, ResultSet and Driver.
99. What is the jspInit() method?
The jspInit() method of the javax.servlet.jsp.JspPage interface is similar to the init()
method of servlets. This method is invoked by the container only once when a JSP
page is initialized. It can be overridden by a page author to initialize resources such
as database and network connections, and to allow a JSP page to read persistent
configuration data.
100. What is the _jspService() method?
The _jspService() method of the javax.servlet.jsp.HttpJspPage interface is invoked
every time a new request comes to a JSP page. This method takes the
HttpServletRequest and HttpServletResponse objects as its arguments. A page
author cannot override this method, as its implementation is provided by the
container.

More Related Content

What's hot (17)

Basic java part_ii
Basic java part_iiBasic java part_ii
Basic java part_ii
Khaled AlGhazaly
 
Top 10 Java Interview Questions and Answers 2014
Top 10 Java Interview Questions and Answers 2014 Top 10 Java Interview Questions and Answers 2014
Top 10 Java Interview Questions and Answers 2014
iimjobs and hirist
 
Core Java
Core JavaCore Java
Core Java
Prakash Dimmita
 
Java interview questions
Java interview questionsJava interview questions
Java interview questions
Soba Arjun
 
Introduction to java
Introduction to java Introduction to java
Introduction to java
Sandeep Rawat
 
Java basic
Java basicJava basic
Java basic
Arati Gadgil
 
Core java interview questions
Core java interview questionsCore java interview questions
Core java interview questions
Rohit Singh
 
50+ java interview questions
50+ java interview questions50+ java interview questions
50+ java interview questions
SynergisticMedia
 
Technical Interview
Technical InterviewTechnical Interview
Technical Interview
prashant patel
 
Core java lessons
Core java lessonsCore java lessons
Core java lessons
vivek shah
 
Core java
Core javaCore java
Core java
Shivaraj R
 
JAVA PROGRAMMING
JAVA PROGRAMMING JAVA PROGRAMMING
JAVA PROGRAMMING
Niyitegekabilly
 
Design pattern
Design patternDesign pattern
Design pattern
Mallikarjuna G D
 
Swing api
Swing apiSwing api
Swing api
Ravi_Kant_Sahu
 
9 crucial Java Design Principles you cannot miss
9 crucial Java Design Principles you cannot miss9 crucial Java Design Principles you cannot miss
9 crucial Java Design Principles you cannot miss
Mark Papis
 
Basic Java Programming
Basic Java ProgrammingBasic Java Programming
Basic Java Programming
Math-Circle
 
Presentation on java
Presentation  on  javaPresentation  on  java
Presentation on java
shashi shekhar
 
Top 10 Java Interview Questions and Answers 2014
Top 10 Java Interview Questions and Answers 2014 Top 10 Java Interview Questions and Answers 2014
Top 10 Java Interview Questions and Answers 2014
iimjobs and hirist
 
Java interview questions
Java interview questionsJava interview questions
Java interview questions
Soba Arjun
 
Introduction to java
Introduction to java Introduction to java
Introduction to java
Sandeep Rawat
 
Core java interview questions
Core java interview questionsCore java interview questions
Core java interview questions
Rohit Singh
 
50+ java interview questions
50+ java interview questions50+ java interview questions
50+ java interview questions
SynergisticMedia
 
Core java lessons
Core java lessonsCore java lessons
Core java lessons
vivek shah
 
9 crucial Java Design Principles you cannot miss
9 crucial Java Design Principles you cannot miss9 crucial Java Design Principles you cannot miss
9 crucial Java Design Principles you cannot miss
Mark Papis
 
Basic Java Programming
Basic Java ProgrammingBasic Java Programming
Basic Java Programming
Math-Circle
 

Similar to Java J2EE Interview Questions Part 2 (20)

Spring Framework
Spring Framework  Spring Framework
Spring Framework
tola99
 
Spring 2
Spring 2Spring 2
Spring 2
Aruvi Thottlan
 
Spring mvc
Spring mvcSpring mvc
Spring mvc
Hamid Ghorbani
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework
Serhat Can
 
Spring Basics
Spring BasicsSpring Basics
Spring Basics
Emprovise
 
Spring from a to Z
Spring from  a to ZSpring from  a to Z
Spring from a to Z
sang nguyen
 
Java spring ppt
Java spring pptJava spring ppt
Java spring ppt
natashasweety7
 
Spring Basics
Spring BasicsSpring Basics
Spring Basics
ThirupathiReddy Vajjala
 
141060753008 3715301
141060753008 3715301141060753008 3715301
141060753008 3715301
ITM Universe - Vadodara
 
Spring (1)
Spring (1)Spring (1)
Spring (1)
Aneega
 
Introduction to Spring sec1.pptx
Introduction to Spring sec1.pptxIntroduction to Spring sec1.pptx
Introduction to Spring sec1.pptx
NourhanTarek23
 
Struts & spring framework issues
Struts & spring framework issuesStruts & spring framework issues
Struts & spring framework issues
Prashant Seth
 
Introduction Java Web Framework and Web Server.
Introduction Java Web Framework and Web Server.Introduction Java Web Framework and Web Server.
Introduction Java Web Framework and Web Server.
suranisaunak
 
Spring framework-tutorial
Spring framework-tutorialSpring framework-tutorial
Spring framework-tutorial
vinayiqbusiness
 
Module 5.ppt.............................
Module 5.ppt.............................Module 5.ppt.............................
Module 5.ppt.............................
Betty333100
 
Spring Framework
Spring FrameworkSpring Framework
Spring Framework
nomykk
 
Spring survey
Spring surveySpring survey
Spring survey
Chris Roeder
 
Introduction to j2 ee frameworks
Introduction to j2 ee frameworksIntroduction to j2 ee frameworks
Introduction to j2 ee frameworks
Mukesh Kumar
 
Signal Framework
Signal FrameworkSignal Framework
Signal Framework
Aurora Softworks
 
Java Spring framework, Dependency Injection, DI, IoC, Inversion of Control
Java Spring framework, Dependency Injection, DI, IoC, Inversion of ControlJava Spring framework, Dependency Injection, DI, IoC, Inversion of Control
Java Spring framework, Dependency Injection, DI, IoC, Inversion of Control
Arjun Thakur
 
Spring Framework
Spring Framework  Spring Framework
Spring Framework
tola99
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework
Serhat Can
 
Spring Basics
Spring BasicsSpring Basics
Spring Basics
Emprovise
 
Spring from a to Z
Spring from  a to ZSpring from  a to Z
Spring from a to Z
sang nguyen
 
Spring (1)
Spring (1)Spring (1)
Spring (1)
Aneega
 
Introduction to Spring sec1.pptx
Introduction to Spring sec1.pptxIntroduction to Spring sec1.pptx
Introduction to Spring sec1.pptx
NourhanTarek23
 
Struts & spring framework issues
Struts & spring framework issuesStruts & spring framework issues
Struts & spring framework issues
Prashant Seth
 
Introduction Java Web Framework and Web Server.
Introduction Java Web Framework and Web Server.Introduction Java Web Framework and Web Server.
Introduction Java Web Framework and Web Server.
suranisaunak
 
Spring framework-tutorial
Spring framework-tutorialSpring framework-tutorial
Spring framework-tutorial
vinayiqbusiness
 
Module 5.ppt.............................
Module 5.ppt.............................Module 5.ppt.............................
Module 5.ppt.............................
Betty333100
 
Spring Framework
Spring FrameworkSpring Framework
Spring Framework
nomykk
 
Introduction to j2 ee frameworks
Introduction to j2 ee frameworksIntroduction to j2 ee frameworks
Introduction to j2 ee frameworks
Mukesh Kumar
 
Java Spring framework, Dependency Injection, DI, IoC, Inversion of Control
Java Spring framework, Dependency Injection, DI, IoC, Inversion of ControlJava Spring framework, Dependency Injection, DI, IoC, Inversion of Control
Java Spring framework, Dependency Injection, DI, IoC, Inversion of Control
Arjun Thakur
 

Recently uploaded (20)

Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]
saniaaftab72555
 
Exploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the FutureExploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the Future
ICS
 
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
Egor Kaleynik
 
Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)
Allon Mureinik
 
Salesforce Aged Complex Org Revitalization Process .pdf
Salesforce Aged Complex Org Revitalization Process .pdfSalesforce Aged Complex Org Revitalization Process .pdf
Salesforce Aged Complex Org Revitalization Process .pdf
SRINIVASARAO PUSULURI
 
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and CollaborateMeet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Maxim Salnikov
 
Agentic AI Use Cases using GenAI LLM models
Agentic AI Use Cases using GenAI LLM modelsAgentic AI Use Cases using GenAI LLM models
Agentic AI Use Cases using GenAI LLM models
Manish Chopra
 
Download YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full ActivatedDownload YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full Activated
saniamalik72555
 
Adobe Illustrator Crack FREE Download 2025 Latest Version
Adobe Illustrator Crack FREE Download 2025 Latest VersionAdobe Illustrator Crack FREE Download 2025 Latest Version
Adobe Illustrator Crack FREE Download 2025 Latest Version
kashifyounis067
 
Landscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature ReviewLandscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature Review
Hironori Washizaki
 
Adobe After Effects Crack FREE FRESH version 2025
Adobe After Effects Crack FREE FRESH version 2025Adobe After Effects Crack FREE FRESH version 2025
Adobe After Effects Crack FREE FRESH version 2025
kashifyounis067
 
Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025
mu394968
 
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
Andre Hora
 
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Dele Amefo
 
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& ConsiderationsDesigning AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Dinusha Kumarasiri
 
Top 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docxTop 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docx
Portli
 
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software DevelopmentSecure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Shubham Joshi
 
Adobe Lightroom Classic Crack FREE Latest link 2025
Adobe Lightroom Classic Crack FREE Latest link 2025Adobe Lightroom Classic Crack FREE Latest link 2025
Adobe Lightroom Classic Crack FREE Latest link 2025
kashifyounis067
 
Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025
kashifyounis067
 
EASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License CodeEASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License Code
aneelaramzan63
 
Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]
saniaaftab72555
 
Exploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the FutureExploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the Future
ICS
 
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
Egor Kaleynik
 
Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)
Allon Mureinik
 
Salesforce Aged Complex Org Revitalization Process .pdf
Salesforce Aged Complex Org Revitalization Process .pdfSalesforce Aged Complex Org Revitalization Process .pdf
Salesforce Aged Complex Org Revitalization Process .pdf
SRINIVASARAO PUSULURI
 
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and CollaborateMeet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Maxim Salnikov
 
Agentic AI Use Cases using GenAI LLM models
Agentic AI Use Cases using GenAI LLM modelsAgentic AI Use Cases using GenAI LLM models
Agentic AI Use Cases using GenAI LLM models
Manish Chopra
 
Download YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full ActivatedDownload YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full Activated
saniamalik72555
 
Adobe Illustrator Crack FREE Download 2025 Latest Version
Adobe Illustrator Crack FREE Download 2025 Latest VersionAdobe Illustrator Crack FREE Download 2025 Latest Version
Adobe Illustrator Crack FREE Download 2025 Latest Version
kashifyounis067
 
Landscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature ReviewLandscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature Review
Hironori Washizaki
 
Adobe After Effects Crack FREE FRESH version 2025
Adobe After Effects Crack FREE FRESH version 2025Adobe After Effects Crack FREE FRESH version 2025
Adobe After Effects Crack FREE FRESH version 2025
kashifyounis067
 
Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025
mu394968
 
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
Andre Hora
 
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Dele Amefo
 
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& ConsiderationsDesigning AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Dinusha Kumarasiri
 
Top 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docxTop 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docx
Portli
 
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software DevelopmentSecure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Shubham Joshi
 
Adobe Lightroom Classic Crack FREE Latest link 2025
Adobe Lightroom Classic Crack FREE Latest link 2025Adobe Lightroom Classic Crack FREE Latest link 2025
Adobe Lightroom Classic Crack FREE Latest link 2025
kashifyounis067
 
Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025
kashifyounis067
 
EASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License CodeEASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License Code
aneelaramzan63
 

Java J2EE Interview Questions Part 2

  • 1. JAVA Interview Questions Part-2 JAVA J2EE Training
  • 2. 51. What are considered as a web component? Java Servlet and Java Server Pages technology components are web components. Servlets are Java programming language that dynamically receive requests and make responses. JSP pages execute as servlets but allow a more natural approach to creating static content. 52. Define Hash table? Hash Table is just like Hash Map or Collection having unique key value pairs. Hash table is a collection of Synchronized object. It does not allow duplicate values but it allows null values. 53. What is Hibernate? Hibernate is a open source object-relational mapping and query service. In hibernate we can write HQL instead of SQL which save developers to spend more time on writing the native SQL. Hibernate has more powerful association, inheritance, polymorphism, composition, and collections. It is a beautiful approach for persisting into database using the java objects. Hibernate also allows you to express queries using java-based criteria.
  • 3. 54. What is ORM? ORM stands for Object-Relational mapping. The objects in a Java class which is mapped in to the tables of a relational database using the metadata that describes the mapping between the objects and the database. It works by transforming the data from one representation to another. 55. Difference between Proxy and Adapter? Adapter object has a different input than the real subject whereas Proxy object has the same input as the real subject. Proxy object is such that it should be placed as it is in place of the real subject. 56. What is MVC? Model-View-Controller is a design pattern wherein Model holds the business logic , Controller controls the flow and View takes care of the presentation part of web application.
  • 4. 57. What is dependency injection or IOC? It's a mechanism of passing object creation to an external component wherein dependent objects are identified and created using configuration. 58. What is bean auto wiring? The Spring container is able to auto wire relationships between collaborating beans. This means that it is possible to automatically let Spring resolve collaborators (other beans) for your bean by inspecting the contents of the BeanFactory without using <constructor-arg> and <property> element. 59. What are the different types of IOC (dependency injection)? Constructor Injection (e.g. Pico container, Spring etc): Dependencies are provided as constructor parameters. Setter Injection (e.g. Spring): Dependencies are assigned through JavaBeans properties (ex: setter methods). Interface Injection (e.g. Avalon): Injection is done through an interface. Note: Spring supports only Constructor and Setter Injection
  • 5. 60. What are the advantages of Spring framework? The advantages of Spring are as follows: Spring has layered architecture. Use what you need and leave you don't need now. Spring Enables POJO Programming. There is no behind the scene magic here. POJO programming enables continuous integration and testability. Dependency Injection and Inversion of Control Simplifies JDBC Open source and no vendor lock-in. 61. What are the common implementations of the Application Context? The three commonly used implementation of 'Application Context' are, ClassPathXmlApplicationContext : It Loads context definition from an XML file located in the classpath, treating context definitions as classpath resources. The application context is loaded from the application's classpath by using the code. ApplicationContext context = new ClassPathXmlApplicationContext("bean.xml"); FileSystemXmlApplicationContext : It loads context definition from an XML file in the filesystem. The application context is loaded from the file system by using the code. ApplicationContext context = new FileSystemXmlApplicationContext("bean.xml"); XmlWebApplicationContext : It loads context definition from an XML file contained within a web application.
  • 6. 62. What is DelegatingVariableResolver? Spring provides a custom JavaServer Faces VariableResolver implementation that extends the standard Java Server Faces managed beans mechanism which lets you use JSF and Spring together. This variable resolver is called as DelegatingVariableResolver. 63. What is Significance of JSF- Spring integration? Spring - JSF integration is useful when an event handler wishes to explicitly invoke the bean factory to create beans on demand, such as a bean that encapsulates the business logic to be performed when a submit button is pressed. 64. What are the ways to access Hibernate using Spring? There are two approaches to Spring’s Hibernate integration: Inversion of Control with a HibernateTemplate and Callback Extending HibernateDaoSupport and Applying an AOP Interceptor.
  • 7. 65. How the AOP used in Spring? AOP is used in the Spring Framework: To provide declarative enterprise services, especially as a replacement for EJB declarative services. The most important such service is declarative transaction management, which builds on the Spring Framework's transaction abstraction. To allow users to implement custom aspects, complementing their use of OOP with AOP. 66. What is Session Tracking? Session simply means a particular interval of time. Session Tracking is a way to maintain state of an user. Http protocol is a stateless protocol. Each time user requests to the server, server treats the request as the new request. So we need to maintain the state of a user to recognize to particular user. 67. How is a typical spring implementation look like? For a typical Spring Application we need the following files: An interface that defines the functions. An Implementation that contains properties, its setter and getter methods, functions etc., Spring AOP (Aspect Oriented Programming) A XML file called spring configuration file. Client program that uses the function.
  • 8. 68. What is Java Server Faces (JSF) - spring integration mechanism? Spring provides a custom JavaServer Faces VariableResolver implementation that extends the standard JavaServer Faces managed beans mechanism. When asked to resolve a variable name, the following algorithm is performed. 69. What is Significance of JSF- Spring integration? Spring - JSF integration is useful when an event handler wishes to explicitly invoke the bean factory to create beans on demand, such as a bean that encapsulates the business logic to be performed when a submit button is pressed. 70. How to integrate your Struts application with spring? To integrate your Struts application with spring, we have two options: Configure spring to manage your Actions as beans, using the ContextLoaderPlugin, and set their dependencies in a spring context file. Subclass Spring's ActionSupport classes and grab your Spring-managed beans explicitly using a getWebApplicationContext() method.
  • 9. 71. How to integrate spring and Hibernate? Spring and Hibernate can integrate using spring’s SessionFactory called LocalSessionFactory. The integration process is of 3 steps. Configure Hibernate mappings. Configure Hibernate properties. Wire dependant object to SessionFactory. 72. What are the ways to access Hibernate using Spring? There are two ways to access Hibernate from Spring: Through Hibernate Template. Subclassing HibernateDaoSupport Extending HibernateDaoSupport and Applying an AOP Interceptor 73. Why most users of the Spring Framework choose declarative transaction management? Most users of the Spring Framework choose declarative transaction management because it is the option with the least impact on application code, and hence is most consistent with the ideals of a non-invasive lightweight container.
  • 10. 74. When to use programmatic and declarative transaction management? Programmatic transaction management is usually a good idea only if you have a small number of transactional operations. On the other hand, if your application has numerous transactional operations, declarative transaction management is usually worthwhile. It keeps transaction management out of business logic, and is not difficult to configure. 75. Explain about the Spring DAO support? The Data Access Object (DAO) support in Spring is aimed at making it easy to work with data access technologies like JDBC, Hibernate or JDO in a consistent way. This allows one to switch between the persistence technologies fairly easily and it also allows one to code without worrying about catching exceptions that are specific to each technology. 76.What are the exceptions thrown by the Spring DAO classes? Spring DAO classes throw exceptions which are subclasses of DataAccessException(org.springframework.dao.DataAccessException).Spring provides a convenient translation from technology-specific exceptions like SQLException to its own exception class hierarchy with the DataAccessException as the root exception. These exceptions wrap the original exception.
  • 11. 77. What is SQLExceptionTranslator? SQLExceptionTranslator, is an interface to be implemented by classes that can translate between SQLExceptions and Spring's own data-access-strategy-agnostic org.springframework.dao.DataAccessException. 78. What is Spring's JdbcTemplate ? Spring's JdbcTemplate is central class to interact with a database through JDBC. JdbcTemplate provides many convenience methods for doing things such as converting database data into primitives or objects, executing prepared and callable statements, and providing custom database error handling. JdbcTemplate template = new JdbcTemplate(myDataSource); 79. What is PreparedStatementCreator ? PreparedStatementCreator: Is one of the most commonly used interfaces for writing data to database. Has one method – createPreparedStatement(Connection) Responsible for creating a PreparedStatement. Does not need to handle SQLExceptions.
  • 12. 80. What is Application Context? A bean factory is fine to simple applications, but to take advantage of the full power of the Spring framework, you may want to move up to Springs more advanced container, the application context. On the surface, an application context is same as a bean factory.Both load bean definitions, wire beans together, and dispense beans upon request. But it also provides: * A means for resolving text messages, including support for internationalization. * A generic way to load file resources. * Events to beans that are registered as listeners. 81. What are the types of Dependency Injection Spring supports? Setter Injection: Setter-based DI is realized by calling setter methods on your beans after invoking a no-argument constructor or no-argument static factory method to instantiate your bean. Constructor Injection: Constructor-based DI is realized by invoking a constructor with a number of arguments, each representing a collaborator.
  • 13. 82. What are the exceptions thrown by the Spring DAO classes ? Spring DAO classes throw exceptions which are subclasses of DataAccessException(org.springframework.dao.DataAccessException).Spring provides a convenient translation from technology-specific exceptions like SQLException to its own exception class hierarchy with the DataAccessException as the root exception. These exceptions wrap the original exception. 83. What is Spring's JdbcTemplate ? Spring's JdbcTemplate is central class to interact with a database through JDBC. JdbcTemplate provides many convenience methods for doing things such as converting database data into primitives or objects, executing prepared and callable statements, and providing custom database error handling. JdbcTemplate template = new JdbcTemplate (myDataSource); 84. Explain the three different methods which are provided by the Namespace Handler interface? The three different methods which are provided by the name space handler interface are: 1) Init() is used to allow initialization for name space handler. 2) BeanDefinition parse is used when a Spring encounters a top level element. 3) BeanDefinitionHandler is used when spring encounters an attribute.
  • 14. 85. Which of the beans available in EJB 3 are only called by clients ? Session and Singleton (EJB 3.1) beans are the ones who encapsulate the business logic which is why it is the only bean which is called by clients. Other beans like MDB and Entity beans are called by session and singleton beans to complete the business requirement. 86. Why is it so to make the session beans into two parts one with interface and the other as implementation to the interface? Or why session beans should be used through business interface? (EJB 3.0 Specific). This approach promotes loose coupling since implementation classes can easily be swapped out without a lot of code changes. But in recent EJB 3.1 specification you don't need to implement a business interface for faster development. 87. What is business interface? An interface through which a client invokes the bean is called a business interface. There are three types of business interfaces available in EJB 3 : Local, Remote and WebService
  • 15. 88. Can we have instance fields in Stateless session bean? Yes. A stateless session bean can have instance field, BUT not for storing state information as opposed to Stateful beans. There may be a need of storing certain shareable resources like data source, JMS source etc, which will be used in the exposed method. So it is perfectly safe to have instance fields in the Stateless session beans. 89. Can you inject Stateful beans into stateless session bean or Servlet? Yes!!. Nobody stops you to inject Stateful beans into stateless session bean or a Servlet. Let’s take a Servlet and inject (definitely as a field in Servlet) a Stateful bean; What happens? Container creates a single instance of a Servlet, so the instance field of Servlet ( which is a Stateful Bean ) injected , is shared among clients.It will lead to drastic data inconsistency ( stored in Stateful bean ) being shared by clients. And this is no different for a Stateful bean injected into stateless bean. So you must AVOID injecting into stateless beans and Servlets. Please don't ask how do you access or make use of Stateful bean in Stateless or Servlet.The answer is JNDI inside the methods of Stateless and doGet() or doPost() of Servlet.
  • 16. 90. What are Pull-MVC and push-MVC based architecture ? Whicharchitecture does Struts2 follow? Pull-MVC and Push-MVC are better understood with how the view layer is getting data i.e. Model to render. In case of Push-MVC the data( Model) is constructed and given to the view layer by the Controllers by putting it in the scoped variables like request or session. Typical example is Spring MVC and Struts1. Pull-MVC on the other hand puts the model data typically constructed in Controllers are kept in a common place i.e. in actions, which then gets rendered by view layer. Struts2 is a Pull-MVC based architecture, in which all data is stored in Value Stack and retrieved by view layer for rendering. 91. Are Interceptors in Struts2 thread safe? No, Unlike Struts2 action, Interceptors are shared between requests, so thread issues will come if not taken care of
  • 17. 92. Are Interceptors and Filters different? , If yes then how? Apart from the fact that both Interceptors and filters are based on intercepting filter,there are few differences when it comes to Struts2. Filters: (1)Based on Servlet Specification (2)Executes on the pattern matches on the request.(3) Not configurable method calls Interceptors: (1)Based on Struts2. (2)Executes for all the request qualifies for a front controller( A Servlet filter ).And can be configured to execute additional interceptor for a particular action execution.(3)Methods in the Interceptors can be configured whether to execute or not by means of excludemethods or includeMethods. ( see tutorial on this Controlling Interceptor Behavior) 93. Which class is the front-controller in Struts2? The class "org.apache.struts2.dispatcher.FilterDispatcher " is the front controller in Struts2. In recent time Struts 2.1.3 this class is deprecated and new classes are introduced to do the job. 94. What is the role of Action/ Model? Actions in Struts are POJO, is also considered as a Model. The role of Action are to execute business logic or delegate call to business logic by the means of action methods which is mapped to request and contains business data to be used by the view layer by means of setters and getters inside the Action class and finally helps the framework decide which result to render.
  • 18. 95. What is the relation between ValueStack and OGNL? A ValueStack is a place where all the data related to action and the action itself is stored. OGNL is a mean through which the data in the ValueStack is manipulated. 96. What is the difference between Action and ActionSupport? Action is interface defines some string like SUCCESS,ERROR etc and an execute() method. For convenience Developer implement this interface to have access to String field in action methods. ActionSupport on other hand implements Action and some other interfaces and provides some feature like data validation and localized error messaging when extended in the action classes by developers 97. Who loads the struts.xml file? Which Struts2 API loads the struts.xml file? In Struts2 FilterServlet is the responsible class for loading struts.xml file as we deploy the application on the container. Unlike Servlet (as with Struts1) needs the load-on-startup tag to load the front controller,a filter doesn't need to have load on startup tag to be loaded as the application is deployed. As with servlet specification a filter is loaded/executed as the application starts up.
  • 19. 98. What is JDBC Driver interface? The JDBC Driver interface provides vendor-specific implementations of the abstract classes provided by the JDBC API. Each vendor driver must provide implementations of the java.sql.Connection, Statement, PreparedStatement, CallableStatement, ResultSet and Driver. 99. What is the jspInit() method? The jspInit() method of the javax.servlet.jsp.JspPage interface is similar to the init() method of servlets. This method is invoked by the container only once when a JSP page is initialized. It can be overridden by a page author to initialize resources such as database and network connections, and to allow a JSP page to read persistent configuration data. 100. What is the _jspService() method? The _jspService() method of the javax.servlet.jsp.HttpJspPage interface is invoked every time a new request comes to a JSP page. This method takes the HttpServletRequest and HttpServletResponse objects as its arguments. A page author cannot override this method, as its implementation is provided by the container.