Access control modifiers express a programming entities ability to be recognized and available to other programming entities. Inside a program there are something things that we want to make public, meaning other parts of the program have access to them, and there are something things we do not want to make public in which we would use the private access modifier. There is also a protected access modifier, which is less common than public and private. Entities that are giving the protected access modifier may be accessed by other classes in the same package or from any subclasses of the class in which they are declared. Access modifiers can be used for variables and methods.

For example:
Code:
public int x;
private int y;
public class myClass(){