javaintellij-ideaide

How to auto add imports in IntelliJ?


I am new to IntelliJ. I am writing some code and am seeing IntelliJ complain that it can't resolve a class/object:

enter image description here

It knows to suggest which import to add but I'm looking for a shortcut that will allow me to say "Yes, please auto add that import!". In Eclipse, this is as easy as Cmd+Shift+O...any ideas here?


Solution

  • Alt-Enter is the shortcut. Actually it's general shortcut for fixing problems which the IDE understands.