Extract Variable

Extract code to a variable

The Extract Variable refactoring wraps a selected expression into a variable. Select an expression and press ⌥⌘V (macOS) / Ctrl+Alt+V (Windows/Linux).


Related Resources

Create a new class
Create a new class
Create a new class and a new package.
JShell
JShell
Use JShell in IntelliJ IDEA to quickly evaluate Java expressions.
Endpoints tool window
Endpoints tool window
Work with endpoints to your application in a dedicated tool window.