IDEA 如何自动导入(import)
如果大家正在使用一个未曾导入(import)过的类,或者它的静态方法或者静态字段,IDEA 会给出对应的建议,只要按下 (option)和回车就可以接受建议。
但我觉得这样做仍然很麻烦,不够智能化。怎么办呢?
打开 IDEA 的首选项,找到 Editor | General | Auto Import。勾选上 Add unambiguous imports on the fly
和 Optimize imports on the fly (for current project)
。