简体   繁体   中英

The import java.util.Collections cannot be resolved

package Collection_1;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;


public class ArrayListMethods {

    public static void main(String[] args) 
    {
        
        List<Integer> intList = new ArrayList<Integer>();
        intList.add(9);
        intList.add(0);
        Collections.sort(intList);
            
        }       

}

This code is giving the error The import java.util.Collections cannot be resolved while importing import java.util.Collections . I'm using sort method from Collections class. I'm using eclipse IDE for writing the code. If anyone has any idea please try to answer.

Ctrl+Shift+O, delete all the imports and do it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM