简体   繁体   中英

The import java.util.Arrays cannot be resolved

i'm using Ubuntu 16, and started tutorial on java, and now i have one issue with my code, the method "Arrays.toString()", like all path "java.util.Arrays", is not found, and i really do not know, what i need to do.

This is my code:

package introtocs.arrayalgorithms;

import java.util.Arrays; // First issue here

public class FillingAndDeleting {

    /**
     * @param args
     */
    public static void main(String[] args) {
        // Filling Arrays
        int[] oneThroughTen = new int[10];
        for (int i = 0; i < oneThroughTen.length; i++) {
            oneThroughTen[i] = i + 1;
            System.out.println(Arrays.toString(oneThroughTen)); // Second here
        }

    }

}

Please help, i cant continue.

该代码在我的日食上正常运行,我想也许您没有构建路径,所以导入Arrays utils时出错。

解决方案是将文件添加到当前Eclipse项目"util -> Arrays.java" ,制作软件包util,然后从链接下载文件Arrays.java。

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