Set - 3

Question 11 :

How can you force garbage collection?

Answer :

You can't force GC, but could request it by calling System.gc(). JVM does not guarantee that GC will be started immediately.


Question 12 :

What is the purpose of the enableEvents() method?

Answer :

The enableEvents() method is used to enable an event for a particular object. Normally, an event is enabled when a listener is added to an object for a particular event. The enableEvents() method is used by objects that handle events by overriding their event-dispatch methods.


Question 13 :

What is the difference between the File and RandomAccessFile classes?

Answer :

The File class encapsulates the files and directories of the local file system. The RandomAccessFile class provides the methods needed to directly access data contained in any part of a file.


Question 14 :

What interface must an object implement before it can be written to a stream as an object?

Answer :

An object must implement the Serializable or Externalizable interface before it can be written to a stream as an object.


Question 15 :

What is the ResourceBundle class?

Answer :

The ResourceBundle class is used to store locale-specific resources that can be loaded by a program to tailor the program's appearance to the particular locale in which it is being run.