This is the mail archive of the java-discuss@sources.redhat.com mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Problems with calling inherited methods


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:

[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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]