Java Interview Questions and Answers - Part 7

The similarity of Clonable and Serializable interfaces is that they both are marker interfaces.....
Arrays in java are static lists that can store a certain kind of variables. Therefore these arrays need to be initialized at the compile time....
An array can be instantiatd in various ways as follows.
Java allows us to cast variables of one type to another as long as the casting happens between compatible data types.......
To send or receive a packet, the sockets send or receive methods can be used: socket.send(packet); socket.receive(packet);....
Field variables: Variable that are declared as a member of a class. OR Variables declared outside any method/constructor but inside the class block......
If any bytes that are previously written and have been buffered by the implementation of the output stream...
Garbage collection in Java identifies and discards the objects that are no longer needed by a program....
Input from the console is read from the System.in object and is then wrapped by an InputStreamReader which reads one character at a time......
If a type exceeds a range of a type, it results in an overflow...
int is one of the primitive datatypes in Java. The Integer class wraps a value of the primitive type int in an object....
The javap is a command that disassembles a class file. It prints out the package.....
The Java virtual machine dynamically loads, links, and initializes classes and interfaces...
StringBuffer class is contained in java.lang package. This class is mutable means the character string in a string buffer gets changed....
In contrast to the String class which implements immutable character strings, the StringBuffer class implements mutable character strings...
A Map is an object that maps keys to values. It is not an extension of the collection interface rather it has own interface hierarchy...
Dynamic class loading: This is done by programmatically invoking the functions of a class loader at run time....
Class loaders are the part of the Java Runtime Environment that dynamically loads Java classes into the Java virtual machine...
For using structs framework, directory structure is created in tomcat. Steps for creating directory structure are:...
Action classes are defined to handle request. Actions exist between Model and view of an application. The struts-config.xml file designates the Action classes that ...
Java native Interface (JNI) is a programming framework that allows Java code to interact with code written in another language...
There are two ways to handle an exception in native code: -The native method can choose to return immediately, causing the exception to be thrown in the Java code ....
Advantages of JNI: 1. JNI enables one to write programs in native language or method when an application cannot be written entirely in the Java programming language...
ServletConfig: It defines how a servlet is configured. ServletConfig is implemented by the servlet container to initialize a single servlet using init ()....
HTTP is called a stateless protocol because in this each command is executed independently, without any knowledge of the commands...
Class and object - A class defines the properties and behavior for the objects represented by the abstraction. Abstraction is a property of object oriented programming...
Throw and throws clause - A program can throw an exception, using throw statement. When an exception is thrown, normal execution is suspended...
Tomcat in java and its usage - Tomcat is an open source servlet container. It was developed by Apache Software Foundation. It is commonly known as Apache Tomcat. It is a web server for the processing of JSP and Java Servlets. When a programmer makes web applications by using servlets or JSP then a .war file is made by compressing the application folder...
Tomcat and Weblogic server - Tomcat is a web server which can run servlets and JSP whereas Weblogic is an application server which can run EJBs also...
Interface and its implementation - Interface is a set of protocols which are used to define the structure of an application...
Static and Non-Static fields - Static variables or fields belong to the class, and not to any object of the class...
What are Class loaders? - Class loaders are the part of the Java Runtime Environment that dynamically loads Java classes....
Dynamic loading - Classloader and its method LoadClass() is used for dynamic loading of a class...
Shallow Cloning - Generally cloning means creating a new instance of a same class and copy all the fields to the new instance...
Deep Cloning - Deep cloning makes a distinct copy of each of object’s field...
Scheduling and Priority works in threads - Threads are assigned priorities that the thread scheduler can use to determine how the threads will be treated...
Single threaded model in servlets - A servlet class is instantiated the first time it is invoked. The same instance will be used over several client requests...
How Java interacts with database? - Java interacts with database with the help of JDBC means Java Database Connectivity...
Different section of JDBC and their usage. - JDBC Driver Manager, which communicates with vendor-specific drivers that perform the real communication with the database...
SQLException class - The SQLException Class and its subtypes provide information about errors and warnings that occurs when the data source is accessed...
CallableStatement interface - It is an interface which is the sub interface of Statement Interface....
Batch updates using CallableStatement interface - Batch update is the ability to add more than one statement at once...
Architecture of a Servet package - The javax.servlet package provides interface and classes for writing servlets....
Different Authentication Options available in Servets - There are four different options for authentication in servlets...
A realm is a collection of pages, images and applications (collectively known as....