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 is jbutton in java?

1 Answers  


What is j2ee tutorial?

1 Answers  


What is the ear file?

1 Answers  


What is a gui in java?

1 Answers  


Describe the ear, war, and jar.

1 Answers  


Is java part of oracle?

1 Answers  


Is java is a high level language?

1 Answers  


What is document root?

1 Answers  


What are the four components of j2ee application?

1 Answers  


What does web module contain?

1 Answers  


what is defect. Is it runtime exception or comiletime exception

3 Answers   L&T,


Is tomcat a java ee?

1 Answers  


Categories