+ 5
constructors
(1)whats the diff btw setter and constructor, (2)can getter be use along with constructor
1 Resposta
+ 6
1) A constructor of the class will be called at the time of object instantiation. These are called only once per object creation.
A setter is a method which can be used to set an object state. This can be called any number of times on an object.
2) Yes constructors and setter methods can coexist within a class and could be used appropriately.