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

Urgent recruitment in CTS for JAVA .Experience 3 to 10 years.

1 Answers   CTS,


Which implicit object in jsp is synchronized?

5 Answers  


What is a java application server?

0 Answers  


What is a java application client?

0 Answers  


What is j2ee server?

0 Answers  






What is meant by applet in java?

0 Answers  


What is instance in java?

0 Answers  


What is java ee used for?

0 Answers  


What is java secure socket extension (jsse)?

0 Answers  


What is java application server?

0 Answers  


What is distributed application?

0 Answers  


How do you run a java program?

0 Answers  


Categories