Solved

Overriding Abstract methods...

Posted on 2004-09-28
6
270 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to parse custom JSON to POJO java 4 56
Eclipse IDE - Cannot copy/paste from console output 8 131
Java passing arguments (type error) 2 48
couple of eclipse 5 25
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
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…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

920 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now