/** * Here we've changed the visibility of Point.y from public * (in Program.java) to private. Now the program does not * compile. Why? */ class Point { public int x; private int y; public static int z; public Point(int x, int y, int z) { this.x = x; this.y = y; this.z = z; } } class Program2 { public static void main(String[] args) { Point p1 = new Point(1,1,1); Point p2 = new Point(3,3,3); int dx = Math.abs(p1.x - p2.x); int dy = Math.abs(p1.y - p2.y); int dz = Math.abs(p1.z - p2.z); System.out.println("Distance between points on the x axis is: " + dx); System.out.println("Distance between points on the y axis is: " + dy); System.out.println("Distance between points on the z axis is: " + dz); } }