Shortcut key for Extract Local Variable in Eclipse/STS
Alt + Shift + L are the shortcut keys to extract/assigned a piece of code to a local variable in Eclipse/STS for Windows/Linux machines.
Similar Post: IntelliJ IDEA shortcut for Extract/Introduce Local Variable
Follow the below steps:
1. Select the code that you want to extract to a local variable.
![Shortcut key for Extract Local Variable in Eclipse/STS](https://websparrow.org/wp-content/uploads/2022/05/shortcut-key-for-extract-local-variable-in-eclipse-sts-1.png)
2. Press the Alt + Shift + L keys together from the keyboard, a pop-up window will be open, choose a variable name and click on the OK button.
![Eclipse Shortcut key for Extract Local Variable in Eclipse/STS](https://websparrow.org/wp-content/uploads/2022/05/shortcut-key-for-extract-local-variable-in-eclipse-sts-2.png)
3. Eclipse/STS IDE automatically assigned selected code to the given variable.
![Eclipse shortcut to extract string value to local variable](https://websparrow.org/wp-content/uploads/2022/05/shortcut-key-for-extract-local-variable-in-eclipse-sts-3.png)
References
- Eclipse/STS shortcut keys for Uppercase and Lowercase
- Eclipse/STS – Optimize/Remove unused imports shortcut keys