This is a deeper question than you think. There are actually a few different styles of getter & setter, and, if you're on a team, it is more important that you are all using the same style than that you pick the "correct" style. If it's just for yourself, what you have is fine. If it is for a school project, the teacher might have a style guide. If it's for a real job, the architect SHOULD have a style guide.
For instance, some people like this style of setter
class PersonalInfo {
private String firstname;
private String lastname;
public PersonalInfo firstname(String firstname) {
this.firstname = firstname;
return this;
}
public PersonalInfo lastname(String lastname) {
this.lastname = lastname;
return this;
}
}
Which allows for code like
PersonalInfo pi = new PersonalInfo()
.firstname("John")
.lastname("Smith");
If you look up builder-style constructors, it's sort of a cheap way to the same result but without actually creating the separate class.
Second, if you're writing these yourself, you're making a mistake. If the editor you're using doesn't have a function to create them, then go download Eclipse and use that.
Third, I'd prefer not writing them at all, but using Lombok. It is a tool that generates all the boilerplate, repetitive stuff that clutters up your source code.