Java32 07/10/2008

What is source and listener?

Source : A source is an object that generates an event. This occurs when the internal state of that object changes in some way.
Listener : A listener is an object that is notified when an event occurs. It has two major requirements. First, it must have been registered with one or more sources to receive notifications about specific types of events. Second, it must implement methods to receive and process these notifications.

What is the lifecycle of an applet?

init() method - Can be called when an applet is first loaded
start() method - Can be called each time an applet is started.
paint() method - Can be called when the applet is minimized or maximized.
stop() method - Can be used when the browser moves off the applet’s page.
destroy() method - Can be called when the browser is finished with the applet.

Can a for statement loop indefinitely?

Yes, a for statement can loop indefinitely. For example, consider the following:
for(;;) ;

What is the immediate superclass of the Applet class?


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.



Leave a Reply

    Java Sets


    July 2008

    RSS Feed