# Extracting a local variable

To extract a local variable from an expression:

- In a Java editor, select the expression that you want to extract to a local variable
- Do one of the following:
  - From the editor's pop-up menu, select Refactor > Extract Local Variable or
  - From the menu bar, select Refactor > Extract Local Variable

Refactoring actions
Refactoring dialogs
Refactoring preferences