O'Reilly logo

Java, A Beginner’s Guide, 5th Edition by Herbert Schildt

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 14: Applets, Events, and Miscellaneous Topics

1. What method is called when an applet first begins running? What method is called when an applet is removed from the system?

When an applet begins, the first method called is init( ). When an applet is removed, destroy( ) is called.

2. Explain why an applet must use multithreading if it needs to run continually.

An applet must use multithreading if it needs to run continually because applets are event-driven programs which must not enter a “mode” of operation. For example, if start( ) never returns, then paint( ) will never be called.

3. Enhance Try This 14-1 so that it displays the string passed to it as a parameter. Add a second parameter that specifies the time delay (in milliseconds) ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required