How to understand the compilation error of rewriting the base class method?

try to change the sort (), method of LinkedList, which originally implements interface list, but always reports an error. Please point out:

import java.util.*;
public class TestSort {

    
LinkedList mtn = new LinkedList();//

public static void main(String[] args){
        new TestSort().go();
}
    public void go(){
        //
        mtn.add("L1");
        mtn.add("E2");
        mtn.add("M3");
        mtn.add("C4");
        
        Compare_str nc = new Compare_str();//
        
        /*:*/
        mtn.sort(nc);

    }        

}
/ definition of comparator /
class Compare_str implements Comparator < String > {

        public int compare(String one ,String two) {
                    return one.compareTo(two);
                }

}
/ is here to test whether sort: can be overwritten in the basic class LinkedList /
class LinkedList implements List < String > {

public void sort(Compare_str testcomp){
    System.out.println("test system method!");
}
/*
*TestSort.java:30: : LinkedList, ListsubList(int,int)
*class LinkedList implements List<String>{
*^
*1 
*/
public LinkedList subList(int from ,int to){};//
/*
*TestSort.java:30: : LinkedList, ListlistIterator(int)
*class LinkedList implements List<String>{
*^
*1 
*/
public Iterator<String> listIterator(int m){};//
/*
*TestSort.java:30: : LinkedList, ListlistIterator(int)
*class LinkedList implements List<String>{
*^
*TestSort.java:47: : LinkedListlistIterator(int)ListlistIterator(int)
*    public Iterator<String> listIterator(int m){};//
*                            ^
  *Iterator<String>ListIterator<String>
  *, E:
*E ListObject
*2 
*/

}


customize a class to inherit LinkedList, override void sort (Comparator c) can be


the upstairs is right. If you just want to change the sort () layout, just write a class that inherits LinkedList, and overrides the sort class.

public class MyLinkedList<E> extends LinkedList<E> {

    @Override
    public void sort(Comparator<? super E> c) {
        // TODO Auto-generated method stub
        super.sort(c);
    }

}

you report this error because your implementation (implements) the List interface, so you must implement all the layouts under List. Your error message is clearly written, and the listIterator method is not overridden. Take a look at the source code of the List interface. There are more than a dozen abstract methods to implement

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b35c7a-2bfa6.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b35c7a-2bfa6.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?