what happens when the same method name is in the superclass AND the interface?

G

Guest

hi all,

i am creating a subclass of File that also implements
javax.swing.tree.TreeNode. TreeNode specifies a getParent() method that
returns a TreeNode. however, the File class also has a getParent() method,
which returns a String. When i try to compile, the compiler complains that
my method getParent() cannot override the getParent() method of the File
class because the return type is wrong!

this is a tricky one. any ideas on how i can create a class that is a
subclass of File and still implements the TreeNode interface?


c
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top