File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

private reference variable

 
karan bhalla
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 820
IntelliJ IDE Tomcat Server VI Editor
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 808
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
got it...
thanks both of you!
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic