Solved

Overriding Abstract methods...

Posted on 2004-09-28
6
277 Views
Last Modified: 2010-03-31
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
Comment
Question by:jamescd23
  • 2
  • 2
6 Comments
 
LVL 92

Accepted Solution

by:
objects earned 50 total points
ID: 12175535
> Do I have to override all of the methods from Collection,

yes

> or is there some way around this issue?

declare class abstract
0
 
LVL 92

Expert Comment

by:objects
ID: 12175541
> 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
 
LVL 86

Expert Comment

by:CEHJ
ID: 12175543
>>Do I have to override all of the methods from Collection

Yes, if you're implementing Collection
0
 
LVL 86

Assisted Solution

by:CEHJ
CEHJ earned 50 total points
ID: 12175554
Why do you *need* to implement Collection? Why not extend a Collection implementation?
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question