ptg7068951
280 HOUR 19:Creating a Threaded Program
Q&A
Q. Are there any reasons to do nothing within a catchstatement,as the
LinkRotatorapplet does?
A. It dependson the type of error or exception being caught. In the
LinkRotatorapplet,you know with both catchstatements what the
cause of an exception would be,so you can be assured that doing
nothing is always appropriate. In the getURL()method,the
MalformedURLExceptionwould be caused only if the URL sent to the
method is invalid.
Q. Whatever happened to the band that sang “My Future’s So Bright,I
Gotta Wear Shades”?
A. Their future was not bright. Timbuk3,a band formed by husband and
wife Pat and Barbara K. MacDonald,never had another hit after the
song that became a top 20 single in 1986. They produced six albums
from 1986 to 1995,when they broke up the band and divorced.
Pat MacDonald continues to perform and release albums under his own
name. He’s also written songs for Cher,Peter Frampton,Night Ranger,
Aerosmith,and other musicians.
Barbara Kooyman performs as Barbara K and has several albums,one
that reinterprets Timbuk3 songs. She also formed the artist’s free
speech charity Artists for Media Diversity.
Their best known song,widely taken to be a positive message about
the future,was supposed to be ironic. The MacDonalds said the bright
future was actually an impending nuclear holocaust.
Workshop
Set aside your threads (in the Java sense, not the nudity sense) and answer
the following questions about multithreading in Java.
Quiz
- What interface must be implemented for a program to use threads?
A. Runnable
B. Thread
C. JApplet