Solved

Overriding Abstract methods...

Posted on 2004-09-28
6
280 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
jsp insert to database example 2 64
going to wrong jsp page 2 50
Glassfish admin console not working 1 60
junit as external jar or library 7 40
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…

726 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