Need extra information about getters, setters and constructors | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Need extra information about getters, setters and constructors

Hi, i am struggling to understand the getters setters and the use of constructors. Is there someone who could explain the use of these 3 in an easy way?

21st Nov 2018, 11:57 AM
David Feliers
David Feliers - avatar
2 Answers
+ 5
Getters and setters for encapsulation https://www.tutorialspoint.com/java/java_encapsulation.htm Constructors use for initializing https://beginnersbook.com/2013/03/constructors-in-java/ The best way to get a better understanding how these work is to practice hands on with your own code (remove bits of code/ add diffrent things / see the diffreneces in output) 😉👍
21st Nov 2018, 12:29 PM
D_Stark
D_Stark - avatar
21st Nov 2018, 1:48 PM
Danijel Ivanović
Danijel Ivanović - avatar