Replacing an expression with a method parameter
To replace an expression with a method parameter:
- In the Java editor, select the expression
- Do one of the following:
- From the menu bar, select Refactor > Introduce Parameter or
- From the editor's pop-up menu, select Refactor > Introduce Parameter
The highlighted expression will be replaced with a reference to a new method parameter.
Callers of the method will be updated to pass the expression as the value of the new parameter.
Note: this refactoring may result in non-compiling code if the highlighted
expression explicitly or implicitly references this
.
Refactoring actions
Refactoring dialogs
Java preferences