Home >Java >JavaBase >One trick to complete IDEA automatic import (import)

One trick to complete IDEA automatic import (import)

angryTom
angryTomforward
2019-11-26 14:12:004301browse

One trick to complete IDEA automatic import (import)

One trick to fix IDEA automatic import

If you are using a class that has not been imported (imported), or its For static methods or static fields, IDEA will give corresponding suggestions. Just press ⌥ (option) and press Enter to accept the suggestions. (Recommended video: java video tutorial)

One trick to complete IDEA automatic import (import)

But I think This is still cumbersome and not smart enough. How to do it?

Open IDEA's preferences and find Editor | General | Auto Import. Check Add unambiguous imports on the fly and Optimize imports on the fly (for current project).

One trick to complete IDEA automatic import (import)

After clicking "OK", the import statement will be automatically imported when copying the code.

One trick to complete IDEA automatic import (import) Of course, the prerequisite is that the import statement is single and determined. If there are multiple options, IDEA will still give corresponding suggestions for you to choose manually.

Okay, you’re done! Give yourself a pat on the back.

This article comes from php Chinese website, java tutorial column, welcome to learn!

The above is the detailed content of One trick to complete IDEA automatic import (import). For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:cnblogs.com. If there is any infringement, please contact admin@php.cn delete