This is the mail archive of the
java-discuss@sources.redhat.com
mailing list for the Java project.
Problems with calling inherited methods
- To: "'java-discuss at sources dot redhat dot com'" <java-discuss at sources dot redhat dot com>
- Subject: Problems with calling inherited methods
- From: Edgar Villanueva <edgarvil at home dot com>
- Date: Sun, 14 Jan 2001 10:18:29 -0500
- Reply-To: edgar at villanueva dot com
There's a problem with compiling classes that call inherited methods.
Here is a class that shows the problem.
import java.util.*;
public class MyLinkedList extends LinkedList
{
public static void main(String args[])
{
MyLinkedList t = new MyLinkedList();
if (t.isEmpty())
System.out.println("list is empty");
else
System.out.println("list has something");
}
}
Here is the error:
[m[edgar@edgar4 temp]$ gcj -c MyLinkedList.java
MyLinkedList.java: In class `MyLinkedList':
MyLinkedList.java: In method `main(java.lang.String[])':
MyLinkedList.java:10: Can't find method `isEmpty()' in type
`MyLinkedList'. Candidates are:
`isEmpty()' in `java.util.List'
`isEmpty()' in `java.util.AbstractCollection'.
if (t.isEmpty())
^
1 error
Helping to make gcj better.