Common design practice is to make instance variables private and have public getters and setters to access them. But many times I have seen code samples on the internet that
Setting variables to private is to encourage encapsulation from other classes.
Unless setName(String) was meant to do something extra (which the method name doesn't imply), it's unnecessary to use the setter while you're in the class where the private variable is.