<分区>
Possible Duplicate:
Is there any performance reason to declare method parameters final in Java?
Why would one mark local variables and method parameters as “final” in Java?
我正在使用 PMD 查看代码违规情况。
在 webService 方法中,我有下面的代码
public ServiceRequest getData()
{
Status status = new Status();
// code
}
PMD 给我的建议是,这个局部变量状态可以声明为 final。
我的问题是,将其定为 final 会导致任何性能改进,或者如果没有,代码可以获得什么好处?