Set - 10

Question 21 :

Can an unreachable object become reachable again?

Answer :

An unreachable object may become reachable again. This can happen when the object's finalize() method is invoked and the object performs an operation which causes it to become accessible to reachable objects.

Question 22 :

What method must be implemented by all threads?

Answer :

All tasks must implement the run() method, whether they are a subclass of Thread or implement the Runnable interface.

Question 23 :

What are synchronized methods and synchronized statements?

Answer :

Synchronized methods are methods that are used to control access to an object. A thread only executes a synchronized method after it has acquired the lock for the method's object or class. Synchronized statements are similar to synchronized methods. A synchronized statement can only be executed after a thread has acquired the lock for the object or class referenced in the synchronized statement.

Question 24 :

What is Externalizable?

Answer :

Externalizable is an Interface that extends Serializable Interface. And sends data into Streams in Compressed Format. It has two methods, writeExternal(ObjectOuput out) and readExternal(ObjectInput in)

Question 25 :

What modifiers are allowed for methods in an Interface?

Answer :

Only public and abstract modifiers are allowed for methods in interfaces.