This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Implements Runnable.... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Implements Runnable...." Watch "Implements Runnable...." New topic
Author

Implements Runnable....

pat grizz
Greenhorn

Joined: Jan 30, 2003
Posts: 3
I was looking at one of the examples in the Java Tutorial and the class is defined like this:
public class Clock extends Applet implements Runnable
Shouldn't the Runnable interface be listed as an interface for the Applet class in the API for version 1.4.1? I can't find the info saying Runnable is an interface for the Applet class. Can someone tell me if I am doing something wrong here?
Greg Charles
Sheriff

Joined: Oct 01, 2001
Posts: 2771
    
  10

The Runnable interface is implemented by any class that wants to be the starting point for a Thread. It defines one method: run(). Applet itself does not implement Runnable, but of couse you are free to extend from Applet and also implement Runnable. I can't think why you would want to do that. It could be that the clock applet uses a thread to make the hands move. I'd have a separate class for that, but maybe they're trying to keep it simple.
pat grizzle
Greenhorn

Joined: Jan 17, 2002
Posts: 2
Thanks for the help Greg. In case you are interested, here is the website where I pulled my question from. It show the clock applet that I was asking about.
http://java.sun.com/docs/books/tutorial/essential/threads/clock.html
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Implements Runnable....
 
Similar Threads
Thread Class
Thread ...........Runnable
extend THREAD / implement RUNNABLE.......which to use?
Multithreading
throw checked exception from inner thread