I wanted to know what's the difference between using a setter and getter to get & initialize an instance variable vs naming your own method to set and get an instance variable?
Does it change anything when calling setCar()
to set a variable instead of mesetCar()
or initializeCar()
?
PS: This is not why use getters and setters instead of public fields its why name the methods setters and getters instead of a random method name