If you have a class A.
class A{ A(int a |){} }
| is the cursor. Crtl + 1 "assign parameter to new field"
Result:
class A{ private final int a; A(int a){ this.a = a; } }
This works also for methods:
void method(int b){}
Will result in:
private int b; void method(int b){ this.b = b; }
Read full article from Can I generate fields automatically in eclipse from a constructor? - Stack Overflow
No comments:
Post a Comment