Moving Statements Around

Moving a line, paragraph or selection up and down.

Moving Content Up or Down in Your Class

With your caret on a line, you can press <⌘⇧↑ (macOS) / Ctrl+Shift+Up Arrow (Windows/Linux), to move a statement up. Alternatively, you can move a statement down with ⌘⇧↓ (macOS) / Ctrl+Shift+Down Arrow. The same shortcut can move a selection up or down. You cannot move statements out of scope.

An Example of Moving Code Around

Let's look at how you can rearrange your code in a whole class in the next step according to your code arrangement rules.