+ 2

What happens when the variable has got first letter in capitals before using it with getters and setters?

While working with getters and setters we need to have the first letter in capitals. But if I have a variable, lets say : 'Axon', it's first letter is already in capitals. So will this be valid also within the code with getAxon()??

30th Nov 2016, 10:05 AM
Tushar Anand
Tushar Anand - avatar
2 odpowiedzi
+ 3
YES! getter And setter is a concept. so it does not matter the naming style in as much as it obeys the rule for naming in Java. however following naming convention is highly recommended as it aides readability. getAxon() is correct following the naming convention but why name the variable Axon
30th Nov 2016, 10:18 AM
damilare lamidi
damilare lamidi - avatar
0
If you follow the naming convention, your variable will have the name "axon" and not "Axon".
30th Nov 2016, 5:05 PM
Codeklopper
Codeklopper - avatar