This week's book giveaway is in the OCAJP forum. We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line! See this thread for details.
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.
posted 4 years ago
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.