• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Implements Runnable....

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Sheriff
Posts: 3063
12
Mac IntelliJ IDE Python VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic