File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes private reference variable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "private reference variable" Watch "private reference variable" New topic
Author

private reference variable

karan bhalla
Greenhorn

Joined: Jul 07, 2011
Posts: 2
what does a PRIVATE reference variable(say... private student s=new student) actually mean??? what about its scope?? help
thanks in advance

Tim McGuire
Ranch Hand

Joined: Apr 30, 2003
Posts: 820

private means that it cannot be accessed from outside of the class. The scope is a class field. It can be accessed by the entire class. There are many reasons why you would want to control access to a variable from being changed or even read from outside the class it is in.
dennis deems
Ranch Hand

Joined: Mar 12, 2011
Posts: 808
Consider a public class Course which has a private reference variable Student:



Now suppose a public class School where a method instantiates Course. When we look at Course from the class School, we will not be able to see the Student variable.
karan bhalla
Greenhorn

Joined: Jul 07, 2011
Posts: 2
got it...
thanks both of you!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: private reference variable