Intellij IDEA keyboard shortcuts for Java developers

Introduction

From this tutorial you would learn some frequently used keyboard shortcuts of Intellij IDEA for java developers.

Environments

  • Intellij IDEA 2016.2+

The keyboard shortcuts

1. organize the imports

  • Windows and Linux
    • CTRL + ALT + O
  • Mac OS
    • control + option + O

This shortcut would remove all the unused imports from current class or interface.

2. show the quick documents of a method

  • Windows and Linux
    • CTRL + Q
  • Mac OS
    • control + j

This shortcut would popup the current method’s javadoc for you, as the picture shows(put the cursor at the submit method and press keyborad shortcut):

show method javadoc

3. Show intention actions and quick-fixes

  • Windows and Linux
    • ALT + ENTER
  • Mac OS
    • option + enter

This shortcut would popup a list of possible actions to be used as the following picture shows. Before do this, you should put your cursor on the class to be imported(in red color).

import class hint

4. Show class/method definition/declaration

  • Windows and Linux
    • CTRL + B
  • Mac OS
    • command + b

Put your cursor at the class/method and press the keyboard shortcuts, the Intellij IDEA would show the definition of the class/method.

5. Generate new methods automatically

  • Windows and Linux
    • ALT + INSERT
  • Mac OS
    • command + n

This keyboard shortcut would do this:

  • generate getter/setters
  • override methods
  • generate constructors
  • generate copyrights

Put your cursor in the class and outside the methods, and Press the keyboard shortcut,just as follows:

create new methods

6. Show interface/base class implementations

  • Windows and Linux
    • CTRL + ALT + B
  • Mac OS
    • command + b

Put your cursor at the interface/base class name, and press the keyboard shortcuts, IntelliJ IDEA would show all the implementations of the this interface/base class.

Just as follows(show all the implementations of the Log class): show implementations

7. Other useful keyboard shortcuts

  • Search everywhere
    • Windows and Linux: Double SHIFT
    • Mac OS: Double SHIFT
  • Show open files history
    • Windows and Linux: CTRL + E
    • Mac OS: command + e
  • Open class file
    • Windows and Linux: CTRL + N
    • Mac OS: command + o
  • Goto the line number
    • Windows and Linux: CTRL + G
    • Mac OS: command + L

Summary

You can find all the default keymap of IntelliJ IDEA here: