Java Interview Questions and Answers - Part 5

Synchronized methods are utilized to control the access to an object especially in multi threaded programming....
The classes are available to the JVM and are referenced by the name. After JVM starts, it introduces the classes into it.....
An abstract has one or more abstract methods apart from concrete methods. All the abstract methods must be overridden by its subclasses....
Vector is synchronized where as ArrayList is not,Vector has a default size of size 10, where as ArrayList has no default size......
A collection is a set of heterogeneous objects. A framework makes the applications efficient, less hard coded.....
Shallow cloning just allows cloning the object but not their internal parts.....
Final, finally and finalize() in Java - final – a key word / access modifier to define constants......
The conversion of a given expression from one type to another type is referred as 'type casting'...
There are 4 types of inner classes - Member inner class, Local inner class, Static inner class and Anonymous inner class...
What are packages in Java? - Package is a collection of classes that avoids name space collision...
Java Native methods - Java applications can call code written in C, C++, or assembler. This is sometimes done for performance.....
Java Reflection API - The Reflection API allows Java code to examine classes and objects at run time. The new reflection classes....
Java Shallow & Deep cloning - Cloning of objects can be very useful if you use the prototype pattern or if you want to store an internal copy of an object....
Java private constructor - Private Constructors can't be access from any derived classes neither from another class. .....
Java Static Initializers - A static initializer block resembles a method with no name, no arguments, and no return type...
notify() Wakes up a single thread that is waiting on this object's monitor...
Event-delegation model allows a separation between a component's design.....
A & B In this, both the operands A as well as B are evaluated and then ‘&’ is applied to them...
A priority is an integer value. Based on this priority the scheduler determines when to execute a task.....
In time slicing methods, a task executes for a predefined slice of time......
Threads communicate by sharing access to fields and the objects......
The observable class represents an observable object.....
ResultSetMetaData is an object that gets information about the types and properties of the columns in a ResultSet object.....
JdbcRowSet is a connected type of rowset as it maintains a connection to the data source using a JDBC driver.....
Difference between static and non-static member of a class - Yes, we can have.
This is also called as constructor overloading....
Describe the use of “instanceof” keyword - “instanceof” keyword is used to check what is the type of object......
What is the disadvantage of garbage collector? - Although garbage collector runs in its own thread, still it has impact on performance. It adds overheads....
What is an Applet? - An applet is a small server side application that can be loaded and controlled on the browser by the client..
Explain the life cycle of an applet. - Below are sequences of methods that describes the life cycle of an applet.....
What is the purpose of finalization? - Finalization is the facility to invoke finalized() method. The purpose of finalization is to perform some action....
Difference between the File and RandomAccessFile classes - The File class is used to perform the operations on files and directories of the file system of an operating......
Define class and object - Class: A class is a program construct which encapsulates data and operations on data. In object oriented.....
Explain class vs. instance with example using java - A class is a program construct which encapsulates data and operations on data......
What is a method? - A java method is a set of statements to perform a task. A method is placed in a class.Signatures of methods...
Difference between instance variable and a class variable - An instance variable is a variable which has one copy per object / instance. That means every object....
Explain how to create instance of a class - Java supports 3 ways of creating instances - By using new operator – Ex : Product prodMouse = new Product();....
What is an abstract class? - A class with one of more abstract methods is called an Abstract class....
Difference between an Abstract class and Interface - An abstract class can have both abstract and concrete methods whereas an interface can have....
What is singleton class? Where is it used? - A class is defined as singleton class, if and only if it can create only one object. This class is useful when.....
Difference between a public and a non-public class - A class with access specifier ‘public’ can be accessed across the packages. A package is like a folder in GUI....
What is Bootstrap, Extension and System Class loader? - The Bootstrap class loader loads key Java classes. Bootstrap class loader loads the basic classes from......
Define JDBC - The JDBC API defines interfaces and classes for making database connections. Using JDBC, you can send SQL....
Describe JDBC Architecture in brief. - Java application calls the JDBC library that loads a driver which talks to the database....
Define ResultSet - ResultSet provides access to the rows of table. A ResultSet maintains a cursor pointing to its current row of data.......
What are the types of JDBC drivers? - Native-API, partly Java driver, also called Type 2..
Define Isolation - Isolation ensures one transaction does not interfere with another. The isolation helps when there are concurrent transactions.....
What are the Transaction levels available? - TRANSACTION_NONE, TRANSACTION_READ_UNCOMMITED, TRANSACTION_READ_COMMITTED....
What is the purpose of setAutoCommit do? - A connection is in auto-commit mode by default which means every SQL statement is treated as a transaction....
What is JDBC driver? - The JDBC Driver provided by the JDBC API, is a vendor-specific implementations of the abstract classes....
What are the steps required to execute a query in JDBC? - Register the driver with DriverManager class.....
What is Connection pooling? - A Connection pooling is a technique of reusing active database connections instead of creating a new connection.....