• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 302
  • Last Modified:

Overriding Abstract methods...

When I compile my code, I get the following error message:
myClass is not abstract and does not override abstract method clear( ) in java.util.Collection

Part of the code does override 3 methods from java.util.Collection, which cant be changed (part of the project), and I cant make this class abstract

My underlying questions are: Do I have to override all of the methods from Collection, or is there some way around this issue?
And if I have to override them all, does that really mean I have to rewrite the whole method, or is there a shortcut to that, assuming I dont need to use those methods?
0
jamescd23
Asked:
jamescd23
  • 2
  • 2
2 Solutions
 
objectsCommented:
> Do I have to override all of the methods from Collection,

yes

> or is there some way around this issue?

declare class abstract
0
 
objectsCommented:
> And if I have to override them all, does that really mean I have to rewrite the whole method, or is there a shortcut to that, assuming I dont need to use those methods?

just make them empy methods if they are not needed
0
 
CEHJCommented:
>>Do I have to override all of the methods from Collection

Yes, if you're implementing Collection
0
 
CEHJCommented:
Why do you *need* to implement Collection? Why not extend a Collection implementation?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now