Use encapsulation/concealing concepts to restrict access to objects.
Getter/setter is often used to limit direct access to specific data and to modify data through specific methods (public). In my case, I try to refrain from using getter/setter as much as possible, but it's not easy.
There seems to be a lot of debate about this. I think it would be better to establish your thoughts by reading many articles.
It's similar to my thoughts on getter/setter, but I think it's well organized. http://lacti.me/2011/10/03/getter-and-setter-at-java/
There are many reasons for toString() overloading, but the biggest reason is that it is the easiest to express information about an object. If you did not override the toString(), the address value would be stamped. There is a limit to checking the information about the object only with that address value. If you use the output function, it's annoying because you have to set it up one by one.
I want to know the fundamental reason..
It's from a book by Zabyfective. Please refer to
© 2024 OneMinuteCode. All rights reserved.