Public instance attributes



examples/public-attributes/TryPoint.java
public class TryPoint {
    public static void main(String[] args) {
        Point a = new Point(2, 3);
        System.out.println(a);
        System.out.println(a.x);
        a.x = 7;
        System.out.println(a.x);
        //System.out.println(a.getX);
    }
}

examples/public-attributes/Point.java
public class Point {
    public int x;
    private int y;
    public Point(int x, int y) {
        this.x = x;
        this.y = y;
    }
}