Skip to content

Commit

Permalink
Add Refactor ExtractVariable
Browse files Browse the repository at this point in the history
  • Loading branch information
mlvandijk committed Dec 7, 2022
1 parent ba1b2ba commit 6989b3b
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package com.jetbrains.refactoring;

public class ExtractVariable {
AnotherClass anotherClass = new AnotherClass();
AnotherClass anotherClass = new AnotherClass();

// The Extract Variable refactoring wraps a selected expression into a variable.
// It adds a new variable declaration and uses the expression as an initializer.
// Select an expression and press ⌥⌘V (Refactor | Extract/Introduce | Variable).
public void method() {
int a = 1;
int b = a + anotherClass.intValue();
int c = b + anotherClass.intValue();
}
// The Extract Variable refactoring wraps a selected expression into a variable.
// It adds a new variable declaration and uses the expression as an initializer.
// Select an expression and press ⌥⌘V (on Mac) or Ctrl+Alt+V (on Windows/Linux)
public void method() {
int a = 1;
int b = a + anotherClass.intValue();
int c = b + anotherClass.intValue();
}
}

class AnotherClass {
Expand Down

0 comments on commit 6989b3b

Please sign in to comment.