Can we use getter and setter in constructor in Java?

If you want to create a instance with the value of int parameter other than 0, you can use constructor . if you are using setters, they are actualy methods, so if you have more than one setters then it is better to use constructor.24 Nis 2017

Sizin İçin Seçtik  How do you call an attribute of an object in Java?

Leave a Reply

Your email address will not be published. Required fields are marked *