When using vscode, it helps me when writing get and set methods and auto fills it in this format:
/**
* @param strength the strength to set
*/
public void setStrength(int strength) {
this.strength = strength;
}
However if I were writing this I would do this:
/**
* sets the strength variable
*/
public void setStrength(int newStrength) {
newStrength = strength;
}
Which would be more correct? Also what does the comment mean in the first one?
I don't believe there is a convention for parameter names in getters and setters. So technically they are both correct. Although, I have always used your first example even when I don't auto generate my methods and you will find a majority of open source Java code will use your first example.
Your comment is a javadoc. Build tools like Maven and Gradle offer the ability of compiling API documentation. IDE's (like VSCode) will also parse the javadoc and provide that to you dynamically. You can see this in action when you hover over method / class names.
I would become familiar with Java documentation, especially if someone else will look at your code. There are quite a few Java tags.