数组无法解决?这是Build路径问题吗? [英] Arrays cannot be resolved? Is this a Build path issue?
问题描述
当我在Eclipse中键入 Arrays.sort(arr)
时,我收到这个错误数组无法解析
当我左键单击红色下划线数组
字我不会按预期得到 import java.util.Arrays
。
我安装了JRE和JDK 1.8.0_20,并且相应地配置了我的项目构建路径。什么可能是一个问题?
When I type Arrays.sort(arr)
in Eclipse, I get this error Arrays cannot be resolved
and when I left click the red underlined Arrays
word I don't get import java.util.Arrays
as expected.
I installed JRE and JDK 1.8.0_20 and my Project build path is configured accordingly. What could be an issue?
推荐答案
手动添加以下行在 .java
file;如果存在包
声明,则会将其附加在其上,否则将其添加到文件的开头(或保持有组织的,按照其他方式按字母顺序添加它进口):
Manually add the following line at the beginning of the .java
file; if a package
declaration is present add it right after it, otherwise add it at the start of the file (or to keep things organized, add it in alphabetic order with respect to other imports):
import java.util.Arrays;
或者:键入 Ctrl + Shift + o 自动导入所有必需的依赖项。
Alternatively: type Ctrl+Shift+o to automatically import all the required dependencies.
这篇关于数组无法解决?这是Build路径问题吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!