I am newbie in J2EE & looking for strong basic behind each
concept as,
Why do we use private access specifier before each variable
of
type property bcoz ultimately to access it outside the class
we use public method as getter & setter ?
If we use getter & setter to access it outside the class so
better we make variable as public so that it is easily
available outside of the class...
Please guide me why do we use as private ????
Answer Posted / srinivaskumar.nimmana
Here data is very important, data means variable.. if our class variable are need access by several classes because of that classes code may corrupt our classes code because of our data directly available to that classes, so we need secure to our data that's why we declare as private variables
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
What are the component of java?
What is delegation?
What is the difference between java and j2ee?
What is j2ee application?
What is element?
What is jaap?
What are the most important topics in java?
What is authorization constraint?
What is authorization?
What is architecture neutral in java?
What is setfocusable in java?
What is the use of jit compiler in java?
What is the description for expression element?
What is 'applet container' ?
What is a web container j2ee?