Professional Documents
Culture Documents
Answer: Containers which uses Border Layout as their default are: window, Frame
and Dialog classes.
• Interfaces provide a form of multiple inheritance. A class can extend only one
other class.
• Interfaces are limited to public methods and constants with no implementation.
Abstract classes can have a partial implementation, protected parts, static
methods, etc.
• A Class may implement several interfaces. But in case of abstract class, a class
may extend only one abstract class.
• Interfaces are slow as it requires extra indirection to to find corresponding method
in in the actual class. Abstract classes are fast.
Similarities:
• Scrollable result sets- using new methods in the ResultSet interface allows
programmatically move the to particular row or to a position relative to its current
position
• JDBC 2.0 Core API provides the Batch Updates functionality to the java
applications.
• Java applications can now use the ResultSet.updateXXX methods.
• New data types - interfaces mapping the SQL3 data types
• Custom mapping of user-defined types (UTDs)
• Miscellaneous features, including performance hints, the use of character streams,
full precision for java.math.BigDecimal values, additional security, and support
for time zones in date, time, and timestamp values.
Question: Explain garbage collection?
Answer: Garbage collection is one of the most important feature of Java. Garbage
collection is also called automatic memory management as JVM automatically
removes the unused variables/objects (value is null) from the memory. User program
cann't directly free the object from memory, instead it is the job of the garbage
collector to automatically free the objects that are no longer referenced by a program.
Every class inherits finalize() method from java.lang.Object, the finalize() method is
called by garbage collector when it determines no more references to the object exists.
In Java, it is good idea to explicitly assign null into a variable when no more in use. I
Java on calling System.gc() and Runtime.gc(), JVM tries to recycle the unused
objects, but there is no guarantee when all the objects will garbage collected.
• Method overloading
• Method overriding through inheritance
• Method overriding through the Java interface
Question: What are Access Specifiers available in Java?
Answer: Access specifiers are keywords that determines the type of access to the
member of a class. These are:
• Public
• Protected
• Private
• Defaults
Primitive Wrapper
boolean java.lang.Boolean
byte java.lang.Byte
char java.lang.Character
double java.lang.Double
float java.lang.Float
int java.lang.Integer
long java.lang.Long
short java.lang.Short
void java.lang.Void