Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Dec 2003
    Posts
    132
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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

  • #2
    Regular Coder
    Join Date
    Dec 2003
    Posts
    367
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #3
    Regular Coder
    Join Date
    Dec 2003
    Posts
    132
    Thanks
    0
    Thanked 0 Times in 0 Posts
    again, shmoove,

    thanks. your a helpful person


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •