I prefer case 2, because in case 1, if someday in the future a local variable name is introduced, it will cause confusion with the person reading your code regarding which variable it refers to.
In case 3, although the scope is clearer, the fact that setters are not used means that sometime in the future you will change the way you set the name field (for example: you want to trim spaces), you must change all the code that changed the variable name, whereas if you used case 2 throughout, you only need to update the setter method.
In my opinion, healthy corporate software development should constantly reorganize the code, as errors are found, and business requirements continue to change, so case 2 will give you an advantage here. But if this is just college homework, then you will leave with affairs 1 and 3.
Potential cases 1 and 3 seem to consume fewer function calls, but won't you get a significant improvement. I dont know.
Also keep in mind that most popular IDEs, such as Eclipse, have the ability to automatically generate getters and setters for you in just a few clicks of the mouse buttons - this should answer "getters and setters - such a problem in Java."
source share