java :Why the Local variable should be declared final [duplicate]
问题 This question already has answers here : Closed 7 years ago . 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? I am using PMD to see the code violations. Inside a webService Method, I have this below code public ServiceRequest getData() { Status status = new Status(); // code } What PMD is suggesting me is that, this local variable status could be declared as final. My