public

Keyword "public" means that given class, interface, method or field is accessible from anywhere.

If a class or interface is public, anyone can create a variable of this type.

If a class is public and its constructor is public, anyone can call this constructor to create new instances of this type.

If a method is public, anyone already having an instance of this type can call this method. If a static method is public, anyone seeing the class can call this static method.

If a field is public, anyone having an instance of this type can access this field. If a static field is public, anyone seeing the class can access the static field.

public class MyPublicClass {

  public static int myPublicStaticField;
  public int myPublicField;

  public MyPublicClass() {  // public constructor
  }

  public static void myPublicStaticMethod() {
  }

  public void myPublicMethod() {
  }

}

viliam@bur.sk