You are on page 1of 4

JAVA General Questions

_____________________________________________________________________________________
1. What are the differences between GET and POST in RESTful Web
Services?
2. What are the diff design approaches to create SOAP based Web
Services?
Ans: Top-Down and Bottom-Up design approaches. They call it as Contract
First or Contract Last.
3.
4.
5.
6.

What are diff ways we can use application context?


Diff between Bean factory and Application Context?
How do you enable spring transactions?
How many ways to initiate Spring transactions?
Ans: Programmatic and Declarative.

7. What are the principle concepts of OOP?


There are four principle concepts upon which object oriented design and
programming rest. They are:
1.
Abstraction
2.
Polymorphism
3.
Inheritance
4.
Encapsulation
8. What is the difference between and statement and a prepare
statement in JDBC? Does the prepared statement do anything other
than allow us to have parameters (multiple uses)? How is this
different than a callable statement (used to call stored procedures)?
9. What is Spring ?
Spring is an open source framework created to address the complexity of enterprise
application development. One of the chief advantages of the Spring framework is its
layered architecture, which allows you to be selective about which of its
components you use while also providing a cohesive framework for J2EE application
development.
10.

What are the advantages of Spring framework?

The advantages of Spring are as follows:


1.
now.
2.
POJO
3.
4.

Spring has layered architecture. Use what you need and leave you don't need
Spring Enables POJO Programming. There is no behind the scene magic here.
programming enables continuous integration and testability.
Dependency Injection and Inversion of Control Simplifies JDBC
Open source and no vendor lock-in.

11.

Why do you need ORM tools like hibernate?

JAVA General Questions


_____________________________________________________________________________________
The main advantage of ORM like hibernate is that it shields developers from messy
SQL. Apart from this, ORM provides following benefits:
1.

Improved productivity
i.
High-level object-oriented API
ii.
Less Java code to write
iii.
No SQL to write

2.

Improved performance
i.
Sophisticated caching
ii.
Lazy loading
iii.
Eager loading

3.

Improved maintainability
i.
A lot less code to write

4.

Improved portability
i.
ORM framework generates database-specific SQL for you
12.
What is differences between RESTful web services and SOAP
web services?

Ans: Though both RESTful web series and SOAP web service can operate cross
platform they are architecturally different to each other, here is some of differences
between REST and SOAP:
1) REST is more simple and easy to use than SOAP. REST language is based on use
of nouns and verbs (better readability)
2) REST uses HTTP protocol for producing or consuming web services while SOAP
uses XML.

The SOAP WS is transport protocol neutral. Supports multiple protocols like


HTTP(S), Messaging, TCP, UDP SMTP, etc.

The REST is transport protocol specific. Supports only HTTP or HTTPS


protocols.
3) REST is lightweight as compared to SOAP and preferred choice in mobile devices
and PDAs. REST does not need XML parsing, no message header (to and from),
hence less bandwidth
4) REST supports different format like text, JSON and XML while SOAP only support
XML.

The SOAP WS permits only XML data format.You define operations, which
tunnels through the POST. The focus is on accessing the named operations and
exposing the application logic as a service.

The REST permits multiple data formats like XML, JSON data, text, HTML, etc.
Any browser can be used because the REST approach uses the standard GET, PUT,
POST, and DELETE Web operations. The focus is on accessing the named resources
and exposing the data as a service. REST has AJAX support. It can use the

JAVA General Questions


_____________________________________________________________________________________
XMLHttpRequest object. Good for stateless CRUD (Create, Read, Update, and
Delete) operations
13.
What happens if RestFull resources are accessed by multiple
clients? Do you need to make it thread-safe?
Ans: Since a new Resource instance is created for every incoming Request there is
no need to make it thread-safe or add synchronization. Multiple clients can safely
access RESTful resources concurrently.
14.
What is criteria API?
15.
What is restriction and projection?
16.
What are the different level CACHE levels in Hibernate?
17.
What are the diff fetch strategies?
18.
What the Ordered collection and sorted collection in
Hibernate?
19.
What is transient variable do in JAVA?
20.
What is volatile key word?
21.
How do you make sure you application code thread safe?
22.
Read about diff types of logs in threads?
1. What are some of the modules in Spring?
Spring comprises of seven modules:
1.
The core container: The core container provides the essential functionality of
the Spring framework. A primary component of the core container is the
BeanFactory, an implementation of the Factory pattern. The BeanFactory applies the
Inversion of Control (IOC) pattern to separate an application's configuration and
dependency specification from the actual application code.
2.
Spring context: The Spring context is a configuration file that provides context
information to the Spring framework. The Spring context includes enterprise
services such as JNDI, EJB, e-mail, internalization, validation, and scheduling
functionality.
3.
Spring AOP: The Spring AOP module integrates aspect-oriented programming
functionality directly into the Spring framework, through its configuration
management feature. As a result you can easily AOP-enable any object managed by
the Spring framework. The Spring AOP module provides transaction management
services for objects in any Spring-based application. With Spring AOP you can
incorporate declarative transaction management into your applications without
relying on EJB components.
4.
Spring DAO: The Spring JDBC DAO abstraction layer offers a meaningful
exception hierarchy for managing the exception handling and error messages
thrown by different database vendors. The exception hierarchy simplifies error
handling and greatly reduces the amount of exception code you need to write, such
as opening and closing connections. Spring DAO's JDBC-oriented exceptions comply
to its generic DAO exception hierarchy.

JAVA General Questions


_____________________________________________________________________________________
5.
Spring ORM: The Spring framework plugs into several ORM frameworks to
provide its Object Relational tool, including JDO, Hibernate, and iBatis SQL Maps. All
of these comply to Spring's generic transaction and DAO exception hierarchies.
6.
Spring Web module: The Web context module builds on top of the application
context module, providing contexts for Web-based applications. As a result, the
Spring framework supports integration with Jakarta Struts. The Web module also
eases the tasks of handling multi-part requests and binding request parameters to
domain objects.
7.
Spring MVC framework: The Model-View-Controller (MVC) framework is a fullfeatured MVC implementation for building Web applications. The MVC framework is
highly configurable via strategy interfaces and accommodates numerous view
technologies including JSP, Velocity, Tiles, iText, and POI.

You might also like