eclipse怎样自动引入包、Organized Imports

2025-04-13 23:28:38

1、注意:本经验采用的Eclipse版本为Eclipse Java EE IDE for Web Developers.Version: 讣嘬铮篌Luna Service Release 1 (4.4.1)Build id: 20140925-1800

eclipse怎样自动引入包、Organized Imports

2、打开编辑好的java代码页面,可以看到ArrayList,File类由于没有import相应的包而报错。

eclipse怎样自动引入包、Organized Imports

3、在编辑区域点击鼠标右键,选择【Source】

eclipse怎样自动引入包、Organized Imports

4、然后选择【Organized Imports】选项

eclipse怎样自动引入包、Organized Imports

5、查看代码可以看到,已经自动import了两个类。注:同时此方法也会删除无用的import

eclipse怎样自动引入包、Organized Imports

6、注意:可以使用快捷键Ctrl+Shift+O

eclipse怎样自动引入包、Organized Imports
声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢