+ 2

Java private variable public class

What is the use of setting instance variables private in a class and define public get and set methods to access them... Such a indirect method plus tedious?

28th Jun 2017, 7:39 PM
Anshul Garg
Anshul Garg - avatar
6 Answers
+ 12
It's for security... You prohibit direct edit this way....
28th Jun 2017, 7:47 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 2
Encapsulation.
28th Jun 2017, 7:54 PM
Rrestoring faith
Rrestoring faith - avatar
+ 1
How??... I don't get the point... How can that be insecure... And what kind of security it provides???
28th Jun 2017, 7:48 PM
Anshul Garg
Anshul Garg - avatar
+ 1
THANKYOU... They must say it Data Validation Technique... As far as i could get it... One again Thanks :)
28th Jun 2017, 7:52 PM
Anshul Garg
Anshul Garg - avatar
0
hello
30th Jun 2017, 1:14 AM
Ramil Jumaev
Ramil Jumaev - avatar