IntelliJ IDEA可以自动优化导入包,但是有多个同名的类位于不同的包时,需要手动使用Alt + Enter进行导入。

  1. 坐标: File --> Settings --> Editor --> General --> AutoImport -->

  2. 把 Add unambiguous imports on the fiy 和 Optimize imports on the fly (for current project) 两个都打上√  --> Apply --> OK

IntelliJ IDEA如何设置自动导入包?

相关文章: