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
Is eclipse written in java?
What is difference between j2ee and java?
What is j2ee and j2se?
What is j2ee technology?
What is instance in java?
What are the main components of the j2ee application?
What is the use of method save()?
What are the components of awt in java?
What is business method?
What is authorization constraint?
What is javaserver pages (jsp)?
What is external entity?
What is attribute what is asant?
What is component-managed sign-on ?
What is architecture neutral in java?