Computer Science, asked by rajiv1144, 1 year ago

What is Getter and Setter in java?


KyloRen314: bro where did u get this question
rajiv1144: What u think?

Answers

Answered by KyloRen314
0

Getter and Setter Methods in Java. If a data member is declared "private", then it can only be accessed within the same class. No outside class can access data member of that class. If you need to access these variables, you have to use public "getter" and "setter" methods.


rajiv1144: Can u give example
ashishbarwar586: why not
Answered by ashishbarwar586
0

Getter and Setter Methods in Java. If a data member is declared "private", then it can only be accessed within the same class. No outside class can access data member of that class. ... Getter and Setter's methods are used to create, modify, delete and view the variables values

Similar questions