For static methods in Java, the parameter cannot have the same name as a global static variable. Is there a convention for naming the parameter? ...just a curiosity.
private static volatile int metBetYetPetLetJet = 8675309;
public static void setMetBetYetPetLetJet (int metBetYetPetLetJet0) {
metBetYetPetLetJet = metBetYetPetLetJet0;
}
The parameter absolutely can have the same name:
public class Foo {
private static volatile int metBetYetPetLetJet = 8675309
public static void setMetBetYetPetLetJet (int metBetYetPetLetJet) {
Foo.metBetYetPetLetJet = metBetYetPetLetJet;
}
}
Alternatively, I often just use value as the parameter name for a setter. That may be the influence of C# though :) Another option is newValue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With