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 6989b3b commit 5f66ce6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.jetbrains.refactoring;

public class AnotherClass {
public int intValue() {
return 1;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,10 @@ public class ExtractVariable {

// 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)
// 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 {
public int intValue() {
return 1;
}
}

0 comments on commit 5f66ce6

Please sign in to comment.