我想在NetBeans中将几个局部变量重构为内部或本地类。有没有办法使用重构工具来完成此操作,例如用于封装字段的move
工具?
E.g:
public double calculate(){
double a=2;
double b=3.14159
return a*b;
}
应该成为:
public double calculate(){
NumberToCalc num = new NumberToCalc();
return num.a*num.b;
}
class NumberToCalc{
double a=2;
double b=3.14159;
}
或
public double calculate(){
class NumberToCalc{
double a=2;
double b=3.14159;
}
NumberToCalc num = new NumberToCalc();
return num.a*num.b;
}