Welcome to AINJ PVT LTD!

JAS IT & INFOTECH SERVICES PVT LTD is an ISO 9001:2015 Certified company. We give training of all types of technical courses here.After completeion of course we provide certificate, also PLACEMENT in reputed companies.


Course Fees Duration
Java 1500 6 month
C,C++ 7500 3 month
Android progeamming 15000 6month
Networking 12000 6month
Hadoop 150000 3 month
Software testing 10000 3 month
Python 12000 3 month
PHP 15000 6 month
VB.NET,ASP.NET 10000 3 month

Course Syllabus

core java
  • Introduction
  • Language Fundamentals
  • Object Oriented Programming
  • Packages
  • Exception Handling
  • Multi Threading
  • Input/Output Operation in Java(java.io Package)
  • GUI Programming
  • Collections Framework & Utility Classes
  • Generics
  • Java SE 6.x/ 7.x Features

Advance java
  • Networking using Java
  • Database Programming using JDBC
  • Servlets
  • Java Beans
  • Java Server Pages
  • Distributed Applications
  • Java Messaging Service [JMS]
  • XML Java Mail API
  • AJAX
  • Java Server Faces
  • ANT, Maven, JUunit, Log4J

Enterprise Java
  • Struts
  • Hibernate
  • Web Services
  • Spring Framework

C Syllabus
  • introduction
  • decision making & looping
  • operators & expressions
  • user defined functions
  • pointers
  • arrays & strings
  • constants, variables & datatypes
  • structures& unions

C++ Syllabus
  • introduction
  • classes & objects
  • opretors & expressions
  • opretors overloading
  • virtuals functions & polymorphism
  • exception handling
  • variables & data types
  • functions in c++
  • constructors & destructors
  • inheritance
  • manipulating strings

C# Syllabus
  • Introduction
  • C# .NET: Variables
  • Conditional Statement
  • Looping Statement
  • Add Menus to your Forms
  • Debugging your Applications
  • Methods
  • Arrays
  • String Manipulation
  • Events
  • Classes and Objects
  • Manipulating Files
  • Databases

Android Progamming

core java
  • Introduction
  • Language Fundamentals
  • Object Oriented Programming
  • Packages
  • Exception Handling
  • Multi Threading
  • Input/Output Operation in Java(java.io Package)
  • GUI Programming
  • Collections Framework & Utility Classes
  • Annotations
  • Reflection
  • Java SE 6.x/ 7.x Features
Iphone App Development
  • Introduction to Android
  • Fundamentals
  • Application Structure
  • Emulator
  • Intents
  • Basic UI design, Styles & Themes
  • Menu
  • Adapters
  • Notifications
  • Customize
  • Fragments

PHP Syllabus

  • introduction
  • Evaluation of Php
  • Defining variable and constant
  • Php Data type
  • Operator and
  • Handling Html Form With Php
  • Decisions and loop
  • Function,String,
  • State
  • String matching with regular
  • Database Connectivity with
Advance PHP
  • introduction
  • Objects
  • Declaring a class
  • The new keyword and constructor
  • Destructor
  • Access method and properties using $this variable
  • Public ,private, protected properties and methods
  • Static properties and method
  • Class constant
  • Inheritance & code reusability
  • Polymorphism
  • Parent:: & self:: keyword
  • Abstract method and class
  • Interface
  • Final

Python Syllabus
  • Introduction To Python
  • Python Data Types
  • Python Program Flow Control
  • Python Functions, Modules And Packages
  • Python String, List And Dictionary Manipulations
  • Python File Operation
  • Python Object Oriented Programming – Oops
  • Python Regular Expression
  • Python Exception Handling
  • Python Database Interaction
  • Python Multithreading
  • Sample Project

Software Testing Syllabus
Manual Testing
  • Testing Overview
  • SDLC
  • STLC
  • Methods of testing
  • Validation
  • Types of Testing
  • Verification
  • Walk through, inspection and Review V Model
  • Special Tests: Requirement, Installation, UI, Usability, Internationalization, Localization, Performance, Load, Stress and many more
  • Test plan
  • Test Case Design Methods
  • Writing and Reviewing Test Cases<
  • Test Execution
  • Defect Management
Automated Testing
  • Role of tools in testing
  • Using software testing tools
  • Role of tools in testing
  • Using software testing tools
  • Users, Roles and Permissions
  • Managing project, Modules and Sub modules
  • Creating test plan, test cases
  • Execution of Test cases
  • Bugzilla
  • Life Cycle
  • Users, Roles and Permissions
  • Managing project, Modules and Submodules
  • Logging and resolving a bug
  • Keywords, Search functionality

.Net Syllabus
  • Intro To Web Technologies
  • Asp.Net Intro
  • Server Side Controls
  • Theme And Skin
  • State Management
  • Ado.Net
  • Linq
  • Caching
  • Asp.Net Configuration
  • Asp.Net Tracing
  • E-Mail Server
  • Security In Asp.Net
  • Xml Web Services
  • Wcf
  • Web Parts
  • Asp.Net Ajax
  • Silverlight
  • Site Navigation
  • Introduction To Sharepoint
  • .Net Enterprise Architecture 4.0
  • C#.Net Language Basics
  • Objects Oriented Programming
  • Memory Management
  • Exception Handling
  • Operator Overloading
  • Gui Application Development
  • Data Base Programming (Ado.Net)
  • Assemblies Delegates
  • User Controls And Event HaPointers Distributed Technologies & .Net Remoting
  • File Handling
  • Windows Services
  • Wpf Programming
  • Multi Threading
  • Security In .Net
  • Introductio
  • Vb.Net And C# Comparison
  • Interoperability With Com
  • Crystal Reports
  • Localization And Globalization
  • Speech Translation
Advanced .NET 4.0
  • Web-services: Concept and Implementation
  • Concept of Ajax, .NET Ajax Toolkit
  • Using Silverlight
  • Windows Presentation Foundation
  • Windows Communication Foundation
  • Workflow Foundation


Basic Hardware
    Basic Electronic circuits
  • Identify different computer peripherals
  • (Computer Fundamentals, Input Output Devices, Microprocessor, Hard Disk Drive, Memory, Power Supply, Motherboard, Computer Maintenance, Slots & Connectors, etc..)
  • Install and configure different hardware resources (Operating System, Driver Installation, Computer Assembly, etc..)
  • installation and troubleshooting Computer Peripherals
  • (Processors, Memory, Motherboards, SMPS, Storage systems (IDE and SATA), Display devices and graphics card, li>Storage system – removable(CD/DVD/Blue Ray), Peripherals and input devices (Mouse, Keyboard, Scanners, Printers)etc..
  • Assembling, disassembling and troubleshooting
  • Assembling and troubleshooting a personal computer
  • Installing, configuring operating system, device driver and Application program
  • Installing Operating System and device drivers
  • Laptop maintenance and their troubles
  • Preventive maintenance of all the components of a computer
  • Gaming PCs and Server

Basic Networking
  • Networking Fundamentals
  • topology
  • Media Standard
  • Media Characteristic
  • Various Wireless Technol>
  • Internet Addressing
  • Identifying Type of Internet Addressing – static , dynamic
  • OSI Reference Model
  • Differentiate between the following network protocols in terms of routing, addressing schemes,
  • interoperability and naming conventions
  • Purpose , functionality of the following protocols used in the TCP/IP suite
  • Explaining Various Switching Technology
  • An Overview of Network Management System
  • Identifying Network Need
  • Incorporating Network Redundancy
  • An Overview of Network Management System
  • Basics of Network Operating System
  • Devices
  • Creating LAN
  • Using TCP/IP Service
  • Using TCP/IP Utilitie
  • Installing and Configuring TCP/IP
  • Identify different computer LAN Components
(1) Install and configure different Essential LAN Components (2) Design Networks and Cabling (3) Troubleshoot Basic Network Issues (4) Installing, configuring Network Operating System (5) Install Network Server-Client computers
Windows Server 2008 Administration
  • Installing Microsoft Windows Server 2008 Configuring print services
  • Configuring file services
  • Maintaining Windows Server 2008 file services
  • Using terminal services gateway
  • Configuring Routing and Remote Access and wireless networking
  • Monitoring servers
  • Maintaining and updating Windows Server 2008
  • Overview of active directory domain services
  • Implementing active directory
  • Configuring and managing the DNS Server role
  • Configuring and managing the DHCP Server role
  • Working with active directory sites
  • Global catalog and FSMO roles
  • Security Planning and Administrative Delegation
  • Active Directory Administration
  • Maintaining network health
  • Introduction to group policy
  • Active directory maintenance
  • Configuring environment using group policy
  • Performing software installation using group policy
  • Backing up ooting and Disaster Recovery (DR)


  • Introduction to Big Data
  • Hadoop Architecture and HDFS
  • Hadoop Clusters and the Hadoop Ecosystem
  • Hadoop MapReduce Framework
  • MapReduce programs in Java
  • Hive and HiveQL
  • NoSQL Databases
  • Oozie and Zookeeper

Interview Questions



Java is a programming language and a platform. Java is a high level, robust, secured and object-oriented programming language. Platform: Any hardware or software environment in which a program runs, is known as a platform. Since Java has its own runtime environment (JRE) and API, it is called platform. Java is an object programming language that was designed to be portable across multiple platforms and operating systems.


platform independence means that the same program works on anyplatform (operating system) without needing any modification. In the case of Java the application runs in a Java Virtual Machine which itself isn't platform independent.


There are five type of memory allocated by JVM: 4 Types (1) Class area (2) heap memory (3) static memory (4) native method stac memory


Yes, it doesn’t matter what comes first. You can write static first and then public.


Constructors are special member functions whose task is to initialize the objects of its class. It is treated as a special member function because its name is the same as the class name.


Variable are declared with in a class, outside of any method, with static keyword are class class variable


A Java virtual machine (JVM) is a process virtual machine that can execute Java bytecode. Each Java source file is compiled into a bytecode file, which is executed by the JVM. Java was designed to allow application programs to be built that could be run on any platform, without having to be rewritten or recompiled by the programmer for each separate platform. A Java virtual machine makes this possible, because it is aware of the specific instruction lengths and other particularities of the underlying hardware platform.


The Java Runtime Environment (JRE) is basically the Java Virtual Machine (JVM) where your Java programs are being executed. It also includes browser plugins for applet execution. The Java Development Kit (JDK) is the full featured Software Development Kit for Java, including the JRE, the compilers and tools (like JavaDoc, and Java Debugger), in order for a user to develop, compile and execute Java applications.


The static keyword denotes that a member variable or method can be accessed, without requiring an instantiation of the class to which it belongs. A user cannot override static methods in Java, because method overriding is based upon dynamic binding at runtime and static methods are statically binded at compile time. A static method is not associated with any instance of a class so the concept is not applicable.


A static variable in Java belongs to its class and its value remains the same for all its instances. A static variable is initialized when the class is loaded by the JVM. If your code tries to access a non-static variable, without any instance, the compiler will complain, because those variables are not created yet and they are not associated with any instance.


Method overloading in Java occurs when two or more methods in the same class have the exact same name, but different parameters. On the other hand, method overriding is defined as the case when a child class redefines the same method as a parent class. Overridden methods must have the same name, argument list, and return type. The overriding method may not limit the access of the method it overrides.


A constructor gets invoked when a new object is created. Every class has a constructor. In case the programmer does not provide a constructor for a class, the Java compiler (Javac) creates a default constructor for that class. The constructor overloading is similar to method overloading in Java. Different constructors can be created for a single class. Each constructor must have its own unique parameter list. Finally, Java does support copy constructors like C++, but the difference lies in the fact that Java doesn’t create a default copy constructor if you don’t write your own.


No, Java does not support multiple inheritance. Each class is able to extend only on one class, but is able to implement more than one interfaces.


Java provides and supports the creation both of abstract classes and interfaces. Both implementations share some common characteristics, but they differ in the following features: • All methods in an interface are implicitly abstract. On the other hand, an abstract class may contain both abstract and no abstract methods. • A class may implement a number of Interfaces, but can extend only one abstract class. • In order for a class to implement an interface, it must implement all its declared methods. However, a class may not implement all declared methods of an abstract class. Though, in this case, the sub-class must also be declared as abstract. • Abstract classes can implement interfaces without even providing the implementation of interface methods. • Variables declared in a Java interface is by default final. An abstract class may contain non-final variables. • Members of a Java interface are public by default. A member of an abstract class can either be private, protected or public. • An interface is absolutely abstract and cannot be instantiated. An abstract class also cannot be instantiated, but can be invoked if it contains a main method.


When an object is passed by value, this means that a copy of the object is passed. Thus, even if changes are made to that object, it doesn’t affect the original value. When an object is passed by reference, this means that the actual object is not passed, rather a reference of the object is passed. Thus, any changes made by the external method, are also reflected in all place


What is the difference between processes and threads ?

A process is an execution of a program, while a Thread is a single execution sequence within a process. A process can contain multiple threads. A Thread is sometimes called a lightweight process.

Explain different ways of creating a thread. Which one would you prefer and why ?

There are three ways that can be used in order for a Thread to be created:

• A class may extend the Thread class.

• A class may implement the Runnable interface.

• An application can use the Executor framework, in order to create a thread pool. The Runnable interface is preferred, as it does not require an object to inherit the Thread class. In case your application design requires multiple inheritance, only interfaces can help you. Also, the thread pool is very efficient and can be implemented and used very easily.

Explain the available thread states in a high-level.

During its execution, a thread can reside in one of the following states:

• Runnable: A thread becomes ready to run, but does not necessarily start running immediately.

• Running: The processor is actively executing the thread code.

• Waiting: A thread is in a blocked state waiting for some external processing to finish.

• Sleeping: The thread is forced to sleep.

• Blocked on I/O: Waiting for an I/O operation to complete.

• Blocked on Synchronization: Waiting to acquire a lock.

• Dead: The thread has finished its execution. Java Interview Questions

What is the difference between a synchronized method and a synchronized block ?

In Java programming, each object has a lock. A thread can acquire the lock for an object by using the synchronized keyword. The synchronized keyword can be applied in a method level (coarse grained lock) or block level of code (fine grained lock).

How does thread synchronization occurs inside a monitor ? What levels of synchronization can you apply ?

The JVM uses locks in conjunction with monitors. A monitor is basically a guardian that watches over a sequence of synchronized code and ensuring that only one thread at a time executes a synchronized piece of code. Each monitor is associated with an object reference. The thread is not allowed to execute the code until it obtains the lock.

What’s a deadlock ?

A condition that occurs when two processes are waiting for each other to complete, before proceeding. The result is that both processes wait endlessly.

How do you ensure that N threads can access N resources without deadlock?

A very simple way to avoid deadlock while using N threads is to impose an ordering on the locks and force each thread to follow that ordering. Thus, if all threads lock and unlock the mutexes in the same order, no deadlocks can arise.

Java Collections

What are the basic interfaces of Java Collections Framework?

Java Collections Framework provides a well-designed set of interfaces and classes that support operations on a collections of objects. The most basic interfaces that reside in the Java Collections Framework are:

• Collection, which represents a group of objects known as its elements.

• Set, which is a collection that cannot contain duplicate elements.

• List, which is an ordered collection and can contain duplicate elements.

• Map, which is an object that maps keys to values and cannot contain duplicate keys.

Why Collection doesn’t extend Cloneable and Serializable interfaces ?

The Collection interface specifies groups of objects known as elements. Each concrete implementation of a Collection can choose its own way of how to maintain and order its elements. Some collections allow duplicate keys, while some other collections don’t. The semantics and the implications of either cloning or serialization come into play when dealing with actual implementations. Thus, the concrete implementations of collections should decide how they can be cloned or serialized.

What is an Iterator ?

The Iterator interface provides a number of methods that are able to iterate over any Collection. Each Java Collection contains the iterator method that returns an Iterator instance. Iterators are capable of removing elements from the underlying collection during the iteration.

What differences exist between Iterator and ListIterator ?

The differences of these elements are listed below:

• An Iterator can be used to traverse the Set and List collections, while the ListIterator can be used to iterate only over Lists.

• The Iterator can traverse a collection only in forward direction, while the ListIterator can traverse a List in both directions.

• The ListIterator implements the Iterator interface and contains extra functionality, such as adding an element, replacing an element, getting the index position for previous and next elements, etc.

What is difference between fail-fast and fail-safe?

The Iterator’s fail-safe property works with the clone of the underlying collection and thus, it is not affected by any modification in the collection. All the collection classes in java.util package are fail-fast, while the collection classes in java. util. concurrent are fail-safe. Fail-fast iterators throw a Concurrent Modification Exception, while fail-safe iterator never throws such an exception.

How HashMap works in Java ?

A HashMap in Java stores key-value pairs. The HashMap requires a hash function and uses hashCode and equals methods, in order to put and retrieve elements to and from the collection respectively. When the put method is invoked, the Hash Map calculates the hash value of the key and stores the pair in the appropriate index inside the collection. If the key exists, its value is updated with the new value. Some important characteristics of a Hash Map are its capacity, its load factor and the threshold resizing.

What is the importance of hash Code () and equals () methods?

In Java, a Hash Map uses the hash Code and equals methods to determine the index of the key-value pair and to detect duplicates. More specifically, the hash Code method is used in order to determine where the specified key will be stored. Since different keys may produce the same hash value, the equals method is used, in order to determine whether the specified key actually exists in the collection or not. Therefore, the implementation of both methods is crucial to the accuracy and efficiency of the HashMap.

What differences exist between HashMap and Hashtable ?

Both the HashMap and Hashtable classes implement the Map interface and thus, have very similar characteristics.

However, they differ in the following features:

• A HashMap allows the existence of null keys and values, while a Hashtable doesn’t allow neither null keys, nor null values.

• A Hashtable is synchronized, while a HashMap is not. Thus, HashMap is preferred in single-threaded environments, while a Hashtable is suitable for multi-threaded environments.

• A HashMap provides its set of keys and a Java application can iterate over them. Thus, a HashMap is fail-fast. On the other hand, a Hashtable provides an Enumeration of its keys.

• The Hashtable class is considered to be a legacy class.

What is the importance of hash Code () and equals () methods?

In Java, a Hash Map uses the hash Code and equals methods to determine the index of the key-value pair and to detect duplicates. More specifically, the hash Code method is used in order to determine where the specified key will be stored. Since different keys may produce the same hash value, the equals method is used, in order to determine whether the specified key actually exists in the collection or not. Therefore, the implementation of both methods is crucial to the accuracy and efficiency of the HashMap.

What is difference between Array and ArrayList ? When will you use Array over ArrayList ?

The Array and ArrayList classes differ on the following features:

• Arrays can contain primitive or objects, while an ArrayList can contain only objects.

• Arrays have fixed size, while an ArrayList is dynamic.

• An ArrayList provides more methods and features, such as addAll, removeAll, iterator, etc.

• For a list of primitive data types, the collections use autoboxing to reduce the coding effort. However, this approach makes them slower when working on fixed size primitive data types.

What is difference between ArrayList and LinkedList ?

Both the ArrayList and LinkedList classes implement the List interface, but they differ on the following features:

• An ArrayList is an index based data structure backed by an Array. It provides random access to its elements with a performance equal to O(1). On the other hand, a LinkedList stores its data as list of elements and every element is linked to its previous and next element. In this case, the search operation for an element has execution time equal to O(n).

• The Insertion, addition and removal operations of an element are faster in a LinkedList compared to an ArrayList, because there is no need of resizing an array or updating the index when an element is added in some arbitrary position inside the collection.

• A LinkedList consumes more memory than an ArrayList, because every node in a LinkedList stores two references, one for its previous element and one for its next element. Check also our article ArrayList vs. LinkedList.

What is Comparable and Comparator interface ?

List their differences. Java provides the Comparable interface, which contains only one method, called compareTo. This method compares two objects, in order to impose an order between them. Specifically, it returns a negative integer, zero, or a positive integer to indicate that the input object is less than, equal or greater than the existing object. Java provides the Comparator interface, which contains two methods, called compare and equals. The first method compares its two input arguments and imposes an order between them. It returns a negative integer, zero, or a positive integer to indicate that the first argument is less than, equal to, or greater than the second. The second method requires an object as a parameter and aims to decide whether the input object is equal to the comparator. The method returns true, only if the specified object is also a comparator and it imposes the same ordering as the comparator.

What is Java Priority Queue ?

The PriorityQueue is an unbounded queue, based on a priority heap and its elements are ordered in their natural order. At the time of its creation, we can provide a Comparator that is responsible for ordering the elements of the PriorityQueue. A PriorityQueue doesn’t allow null values, those objects that doesn’t provide natural ordering, or those objects that don’t have any comparator associated with them. Finally, the Java PriorityQueue is not thread-safe and it requires O(log(n)) time for its enqueing and dequeing operations.

What do you know about the big-O notation and can you give some examples with respect to different data structures ?

The Big-O notation simply describes how well an algorithm scales or performs in the worst case scenario as the number of elements in a data structure increases. The Big-O notation can also be used to describe other behavior such as memory consumption. Since the collection classes are actually data structures, we usually use the Big-O notation to chose the best implementation to use, based on time, memory and performance. Big-O notation can give a good indication about performance for large amounts of data.

What is the tradeoff between using an unordered array versus an ordered array ?

The major advantage of an ordered array is that the search times have time complexity of O(log n), compared to that of an unordered array, which is O (n). The disadvantage of an ordered array is that the insertion operation has a time complexity of O(n), because the elements with higher values must be moved to make room for the new element. Instead, the insertion operation for an unordered array takes constant time of O(1).

What are some of the best practices relating to the Java Collection framework ?

• Choosing the right type of the collection to use, based on the application’s needs, is very crucial for its performance. For example if the size of the elements is fixed and know a priori, we shall use an Array, instead of an ArrayList.

• Some collection classes allow us to specify their initial capacity. Thus, if we have an estimation on the number of elements that will be stored, we can use it to avoid rehashing or resizing.

• Always use Generics for type-safety, readability, and robustness. Also, by using Generics you avoid the ClassCastException during runtime.

• Use immutable classes provided by the Java Development Kit (JDK) as a key in a Map, in order to avoid the implementation of the hashCode and equals methods for our custom class.

• Program in terms of interface not implementation. • Return zero-length collections or arrays as opposed to returning a null in case the underlying collection is actually empty.

What’s the difference between Enumeration and Iterator interfaces?

Enumeration is twice as fast as compared to an Iterator and uses very less memory. However, the Iterator is much safer compared to Enumeration, because other threads are not able to modify the collection object that is currently traversed by the iterator. Also, Iterator sallow the caller to remove elements from the underlying collection, something which is not possible with Enumerations.

What is the difference between HashSet and TreeSet ?

The HashSet is implemented using a hash table and thus, its elements are not ordered. The add, remove, and contains methods of a HashSet have constant time complexity O(1). On the other hand, a Tree Set is implemented using a tree structure. The elements in a TreeSet are sorted, and thus, the add, remove, and contains methods have time complexity of O(logn).

Exception Handling

What are the two types of Exceptions in Java ? Which are the differences between them ?

Java has two types of exceptions: checked exceptions and unchecked exceptions. Unchecked exceptions do not need to be declared in a method or a constructor’s throws clause, if they can be thrown by the execution of the method or the constructor, and propagate outside the method or constructor boundary. On the other hand, checked exceptions must be declared in a method or a constructor’s throws clause. See here for tips on Java exception handling.

What is the difference between Exception and Error in java ?

Exception and Error classes are both subclasses of the Throwable class. The Exception class is used for exceptional conditions that a user’s program should catch. The Error class defines exceptions that are not excepted to be caught by the user program.

What is the difference between throw and throws ?

The throw keyword is used to explicitly raise a exception within the program. On the contrary, the throws clause is used to indicate those exceptions that are not handled by a method. Each method must explicitly specify which exceptions does not handle, so the callers of that method can guard against possible exceptions. Finally, multiple exceptions are separated by a comma.

What is the importance of finally block in exception handling ?

A finally block will always be executed, whether or not an exception is actually thrown. Even in the case where the catch statement is missing and an exception is thrown, the finally block will still be executed. Last thing to mention is that the finally block is used to release resources like I/O buffers, database connections, etc.

What will happen to the Exception object after exception handling ?

The Exception object will be garbage collected in the next garbage collection.

How does finally block differ from finalize() method ?

A finally block will be executed whether or not an exception is thrown and is used to release those resources held by the application. Finalize is a protected method of the Object class, which is called by the Java Virtual Machine (JVM) just before an object is garbage collected


What is JDBC?

JDBC is an abstraction layer that allows users to choose between databases. JDBC enables developers to write database applications in Java, without having to concern themselves with the underlying details of a particular database. Explain the role of Driver in JDBC. The JDBC Driver provides vendor-specific implementations of the abstract classes provided by the JDBC API. Each driver must provide implementations for the following classes of the java.sql package:Connection, Statement, PreparedStatement, CallableStatement, ResultSet and Driver.

What is the purpose Class.forName method ?

This method is used to method is used to load the driver that will establish a connection to the database. 9.4 What is the advantage of PreparedStatement over Statement ? PreparedStatements are precompiled and thus, their performance is much better. Also, PreparedStatement objects can be reused with different input values to their queries.

What is the use of Callable Statement?

Name the method, which is used to prepare a CallableStatement. A CallableStatement is used to execute stored procedures. Stored procedures are stored and offered by a database. Stored procedures may take input values from the user and may return a result. The usage of stored procedures is highly encouraged, because it offers security and modularity.The method that prepares a CallableStatement is the following: CallableStament. prepareCall();

What does Connection pooling mean ?

The interaction with a database can be costly, regarding the opening and closing of database connections. Especially, when the number of database clients increases, this cost is very high and a large number of resources is consumed. A pool of database connections is obtained at start up by the application server and is maintained in a pool. A request for a connection is served by a connection residing in the pool. In the end of the connection, the request is returned to the pool and can be used to satisfy future requests.


What is a Servlet ?

The servlet is a Java programming language class used to process client requests and generate dynamic web content. Servlets are mostly used to process or store data submitted by an HTML form, provide dynamic content and manage state information that does not exist in the stateless HTTP protocol.

Explain the architechure of a Servlet.

The core abstraction that must be implemented by all servlets is the javax.servlet.Servlet interface. Each servlet must implement it either directly or indirectly, either by extending javax.servlet.GenericServlet or javax.servlet.http.HTTPServlet. Finally, each servlet is able to serve multiple requests in parallel using multithreading.

What is the difference between an Applet and a Servlet ?

An Applet is a client side java program that runs within a Web browser on the client machine. On the other hand, a servlet is a server side component that runs on the web server.An applet can use the user interface classes, while a servlet does not have a user interface. Instead, a servlet waits for client’s HTTP requests and generates a response in every request.

What is the difference between GenericServlet and HttpServlet ?

GenericServlet is a generalized and protocol-independent servlet that implements the Servlet and ServletConfig interfaces. Those servlets extending the GenericServlet class shall override the service method. Finally, in order to develop an HTTP servlet for use on the Web that serves requests using the HTTP protocol, your servlet must extend the HttpServlet instead. Check Servlet examples here.

Explain the life cycle of a Servlet.

On every client’s request, the Servlet Engine loads the servlets and invokes its init methods, in order for the servlet to be initialized. Then, the Servlet object handles all subsequent requests coming from that client, by invoking the service method for each request separately. Finally, the servlet is removed by calling the server’s destroy method.

What is the difference between doGet() and doPost() ?

doGET: The GET method appends the name-value pairs on the request’s URL. Thus, there is a limit on the number of characters and subsequently on the number of values that can be used in a client’s request. Furthermore, the values of the request are made visible and thus, sensitive information must not be passed in that way. doPOST: The POST method overcomes the limit imposed by the GET request, by sending the values of the request inside its body. Also, there is no limitations on the number of values to be sent across. Finally, the sensitive information passed through a POST request is not visible to an external client.

What is meant by a Web Application ?

A Web application is a dynamic extension of a Web or application server. There are two types of web applications: presentationoriented and service-oriented. A presentation-oriented Web application generates interactive web pages, which contain various types of markup language and dynamic content in response to requests. On the other hand, a service-oriented web application implements the endpoint of a web service. In general, a Web application can be seen as a collection of servlets installed under a specific subset of the server’s URL namespace.

What is a Server Side Include (SSI) ?

Server Side Includes (SSI) is a simple interpreted server-side scripting language, used almost exclusively for the Web, and is embedded with a servlet tag. The most frequent use of SSI is to include the contents of one or more files into a Web page on a Web server. When a Web page is accessed by a browser, the Web server replaces the servlet tag in that Web page with the hyper text generated by the corresponding servlet.

What is Servlet Chaining ?

Servlet Chaining is the method where the output of one servlet is sent to a second servlet. The output of the second servlet can be sent to a third servlet, and so on. The last servlet in the chain is responsible for sending the response to the client.

How do you find out what client machine is making a request to your servlet ?

The Servlet Request class has functions for finding out the IP address or host name of the client machine. getRemoteAddr() gets the IP address of the client machine and getRemoteHost() gets the host name of the client machine. See example here.

What is the structure of the HTTP response ?

The HTTP response consists of three parts:

• Status Code: describes the status of the response. It can be used to check if the request has been successfully completed. In case the request failed, the status code can be used to find out the reason behind the failure. If your servlet does not return a status code, the success status code, HttpServletResponse.SC_OK, is returned by default.

• HTTP Headers: they contain more information about the response. For example, the headers may specify the date/time after which the response is considered stale, or the form of encoding used to safely transfer the entity to the user. See how to retrieve headers in Servlet here .

• Body: it contains the content of the response. The body may contain HTML code, an image, etc. The body consists of the data bytes transmitted in an HTTP transaction message immediately following the headers.

What is a cookie ?What is the difference between session and cookie ?

A cookie is a bit of information that the Web server sends to the browser. The browser stores the cookies for each Web server in a local file. In a future request, the browser, along with the request, sends all stored cookies for that specific Web server.The differences between session and a cookie are the following:

• The session should work, regardless of the settings on the client browser. The client may have chosen to disable cookies. However, the sessions still work, as the client has no ability to disable them in the server side.

• The session and cookies also differ in the amount of information the can store. The HTTP session is capable of storing any Java object, while a cookie can only store String objects.

Which protocol will be used by browser and servlet to communicate ?

The browser communicates with a servlet by using the HTTP protocol.

What is HTTP Tunneling ?

HTTP Tunneling is a technique by which, communications performed using various network protocols are encapsulated using the HTTP or HTTPS protocols. The HTTP protocol therefore acts as a wrapper for a channel that the network protocol being tunneled uses to communicate. The masking of other protocol requests as HTTP requests is HTTP Tunneling.

What’s the difference between sendRedirect and forward methods ?

The sendRedirect method creates a new request, while the forward method just forwards a request to a new target. The previous request scope objects are not available after a redirect, because it results in a new request. On the other hand, the previous request scope objects are available after forwarding. FInally, in general, the sendRedirect method is considered to be slower compare to the forward method.

What is URL Encoding and URL Decoding ?

The URL encoding procedure is responsible for replacing all the spaces and every other extra special character of a URL, into their corresponding Hex representation. In correspondence, URL decoding is the exact opposite procedure.


What is a JSP Page ?

A Java Server Page (JSP) is a text document that contains two types of text: static data and JSP elements. Static data can be expressed in any text-based format, such as HTML or XML. JSP is a technology that mixes static content with dynamically generated content.

How are the JSP requests handled ?

On the arrival of a JSP request, the browser first requests a page with a .jsp extension. Then, the Web server reads the request and using the JSP compiler, the Web server converts the JSP page into a servlet class. Notice that the JSP file is compiled only on the first request of the page, or if the JSP file has changed.The generated servlet class is invoked, in order to handle the browser’s request. Once the execution of the request is over, the servlet sends a response back to the client. See how to get Request parameters in a JSP.

What are the advantages of JSP ?

The advantages of using the JSP technology are shown below:

• JSP pages are dynamically compiled into servlets and thus, the developers can easily make updates to presentation code.

• JSP pages can be pre-compiled.

• JSP pages can be easily combined to static templates, including HTML or XML fragments, with code that generates dynamic content.

• Developers can offer customized JSP tag libraries that page authors access using an XML-like syntax.

• Developers can make logic changes at the component level, without editing the individual pages that use the application’s logic.

What are Directives ? What are the different types of Directives available in JSP ?

Directives are instructions that are processed by the JSP engine, when the page is compiled to a servlet. Directives are used to set page-level instructions, insert data from external files, and specify custom tag libraries. Directives are defined between < %@ and % >. The different types of directives are shown below:

• Include directive: it is used to include a file and merges the content of the file with the current page.

• Page directive: it is used to define specific attributes in the JSP page, like error page and buffer.

• Taglib: it is used to declare a custom tag library which is used in the page.

What are JSP actions ?

JSP actions use constructs in XML syntax to control the behavior of the servlet engine. JSP actions are executed when a JSP page is requested. They can be dynamically inserted into a file, re-use JavaBeans components, forward the user to another page, or generate HTML for the Java plugin.Some of the available actions are listed below:

• jsp:include - includes a file, when the JSP page is requested .

• jsp:useBean - finds or instantiates a JavaBean.

• jsp:setProperty - sets the property of a JavaBean.

• jsp:getProperty - gets the property of a JavaBean.

• jsp:forward - forwards the requester to a new page.

• jsp:plugin - generates browser-specific code.

What are Scriptlets ?

In Java Server Pages (JSP) technology, a scriptlet is a piece of Java-code embedded in a JSP page. The scriptlet is everything inside the tags. Between these tags, a user can add any valid scriplet.

What are Decalarations ?

Declarations are similar to variable declarations in Java. Declarations are used to declare variables for subsequent use in expressions or scriptlets. To add a declaration, you must use the sequences to enclose your declarations.

What are Expressions ?

A JSP expression is used to insert the value of a scripting language expression, converted into a string, into the data stream returned to the client, by the web server. Expressions are defined between tags.

What is meant by implicit objects and what are they ?

JSP implicit objects are those Java objects that the JSP Container makes available to developers in each page. A developer can call them directly, without being explicitly declared. JSP Implicit Objects are also called pre-defined variables.The following objects are considered implicit in a JSP page: • application

• page

• request

• response

• session

• exception

• out

• config

• pageContext

What are the advantages of JSP over Active Server Pages ASP?

The advantages of JSP are twofold. First, the dynamic part is written in Java, not Visual Basic or other MS specific language, so it is more powerful and easier to use. Second, it is portable to other operating systems and non-Microsoft Web servers.

What are the advantages of JSP over Pure Servlets?

It is more convenient to write andtomodify! Regular HTML than to have plenty of printing statements that generate the HTML. Other advantages are: Embedding of Java code in HTML pages. Platform independence. Creation of database-driven Web applications. Server-side programming capabilities.

What are the advantages of JSP over Server-Side Includes SSI?

SSI is really only intended for simple inclusions, not for "real" programs that use form data, make database connections, and the like.

What are the advantages of JSP over JavaScript?

JavaScript can generate HTML dynamically on the client but can hardly interact with the web server to perform complex tasks like database access and image processing etc.

What are the advantages of JSP over Static HTML?

Regular HTML, of course, cannot contain dynamic information.

Explain lifecycle of a JSP.

A JSP Lifecycle consists of following steps:


When a browser asks for a JSP, the JSP engine first checks to see whether it needs to compile the page. If the page has never been compiled, or if the JSP has been modified since it was last compiled, the JSP engine compiles the page.

The compilation process involves three steps:

Parsing the JSP.

Turning the JSP into a servlet.

Compiling the servlet.


When a container loads a JSP it invokes the jspInit method before servicing any requests


Whenever a browser requests a JSP and the page has been loaded and initialized, the JSP engine invokes the _jspService method in the JSP.The _jspService method of a JSP is invoked once per a request and is responsible for generating the response for that request and this method is also responsible for generating responses to all seven of the HTTP methods ie. GET, POST, DELETE etc.


The destruction phase of the JSP life cycle represents when a JSP is being removed from use by a container. The jspDestroy method is the JSP equivalent of the destroy method for servlets.