Sometimes you copy any java code from somewhere and you see many import errors. You go to each class and press ctrl + space to import each class one by one. Lets say you have large number of classes, you have to import each class one by one.
Eclipse have provided organize imports feature which can import all classes at once and prompt you to select any class if there are multiple classes of same name present in classpath.
Right click -> source -> organize imports
ctrl + shift + o
Lets understand with the help of example:
You can see, we need to import lot of classes. Just press ctrl + shift + o, you will see below screen.
Bingo!! you have resolved all import errors at once. I use this shortcut very often, I hope you find it useful.
Join Our News Letter – Stay Updated
Subscribe to Awesome Java Content.