Go Back   CodingForums.com > :: Server side development > Java and JSP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-15-2004, 03:16 PM   PM User | #1
warhammerdude20
Regular Coder

 
Join Date: Dec 2003
Posts: 132
Thanks: 0
Thanked 0 Times in 0 Posts
warhammerdude20 is an unknown quantity at this point
java implementing question

i am making an applet that requieres i implement Runnable as well as KeyListener...

is it possible to go something like:
Code:
class Whatever implements Runnable implements KeyListener{
thanks
warhammerdude20 is offline   Reply With Quote
Old 03-15-2004, 04:00 PM   PM User | #2
shmoove
Regular Coder

 
Join Date: Dec 2003
Posts: 367
Thanks: 0
Thanked 0 Times in 0 Posts
shmoove is an unknown quantity at this point
Yes, but your syntax is a bit off:
Code:
class Whatever implements Runnable, KeyListener{
As long as you make sure to implement all the necesary methods (but I guess you already know that), you'll be fine.
Multiple "implements" is exactly the reason they have interfaces in Java, so you wouldn't need multiple inheritance (it's safer using interfaces).

shmoove
shmoove is offline   Reply With Quote
Old 03-15-2004, 06:47 PM   PM User | #3
warhammerdude20
Regular Coder

 
Join Date: Dec 2003
Posts: 132
Thanks: 0
Thanked 0 Times in 0 Posts
warhammerdude20 is an unknown quantity at this point
again, shmoove,

thanks. your a helpful person
warhammerdude20 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:23 PM.


Advertisement
Log in to turn off these ads.