JAVA Interview Question Answers - 1

JAVA Interview Question Answers - 1

For which statements does it make sense to use a label?
The only statements for which it makes sense to employ a label are those statements that can enclose a break or continue statement.

What is the purpose of finalization?
The purpose of finalization is to give an unreachable entity the opportunity to perform any cleanup processing before the body is garbage collected.

What is synchronization and why is it valuable?
With respect to multithreading, synchronization is the capability to control the access of multiple threads to shared resources. Without synchronization, it is imaginable for one thread to modify a shared entity while another thread is in the action of using or updating that entity's value. This
often leads to significant errors.

What is the % operator?
It is referred to as the modulo or remainder operator. It returns the remainder of dividing the first operand by the second operand

Can an object's finalize() method be invoked while it is reachable?
An object's finalize() method cannot be invoked by the garbage collector while the object is still
reachable. However, an object's finalize() method may be invoked by other objects.

What's advanced with the stop(), suspend() and resume() methods in JDK 1.2?
The stop(), suspend() and resume() methods have been deprecated in JDK 1.2.

What is the Map interface?
The Map interface replaces the JDK 1.1 Dictionary class and is used associate keys with values.

Does a class inherit the constructors of its superclass?
A class does not inherit constructors from any of its super classes.

What restrictions are placed on the location of a package statement within a source code case?
A package statement must appear as the first border in a source code case (excluding blank lines and comments).

Which containers apply a border Layout as their default layout?
The window, Frame and Dialog classes apply a border layout as their default layout

What is an object's lock and which objects have locks?
An body's lock is a mechanism that is used by multiple threads to obtain synchronized access to the body. A thread may execute a synchronized method of an object only after it has acquired the object's lock. All objects and classes have locks. A class's lock is acquired on the class's Class object.

Share this

Related Posts

There was an error in this gadget