EMZETT.
Login

Getter

In short: A getter is a method that returns the value of a private attribute.

In more detail: It follows the naming rule getAttribute() (for boolean often isAttribute()).

In Depth

private String name;
public String getName() { return name; }

With getters and setters the attribute stays private; the class can later add checks or calculations without callers having to change. See access modifiers.

See also: Setter, private, Access Modifiers