Explicitly refer to a method parameter in Java
I'd simply like to know if the following is possible to do somehow.
public void foo(int a) {
String a = Integer.toString(a);
}
Now obviously this code doesn't actually work; the string a shadows the
parameter a. What I'd like to know is, is there a way to explicitly tell
the compiler "Hey, this is actually that other a up there!" I'm looking
for something similar to the this keyword, except for method parameters.
Is there anything like this or am I forced to use a different variable name?
No comments:
Post a Comment