I’ve encountered the code similar to this:
public void foo(String param1) {
final String param1F = param1;
...
}
I doubt that the author doesn’t know that he can put final keyword directly in the method signature cause in the rest of the method he only uses param1F but I’m curious if anyone has the idea for what this could be useful?
In this case, you could reassign
param1, which wouldn’t be possible, ifparam1was final.So there is a slight difference. But to me it is not useful, just because I do not change method parameters in general.