Use of private variable while creating properties ???



Use of private variable while creating properties ???..

Answer / m4n07

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 ????

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More J2EE Interview Questions

What do you mean by the component contract?

0 Answers  


what is the main use of the RequestDispatch object, how we this in realtime project

3 Answers  


What is difference between j2ee and java?

0 Answers  


What is jbutton in java?

0 Answers  


What is document root?

0 Answers  






Difference between load and get method?

0 Answers  


What is java transaction api (jta)?

0 Answers  


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 ????

3 Answers   CTS,


What is the concept of connection pooling?

0 Answers  


How can I be good in java?

0 Answers  


What is event in java?

0 Answers  


How many types of objects are there in java?

0 Answers  


Categories