Hello StackOverflow Community! I hope you're having a nice day.
I'm asking myself if I can just decrease an int obtained from a getXYZ() method of another class (the int should also be modified in the other class) or if I must use a setter?
for example:
Class: Monster
public int getHealth() {
return health;
}
Class: Bullet
applyDamage(target);
private void applyDamage(Monster target) {
target.getHealth() - 1; // OR
target.setHealth(4);
}