...
This compliant solution declares the Point class and its getPoint() method as package-private, which allows the Point class to be nonfinal and allows getPoint() to be invoked by classes present within the same package and loaded by a common class loader.:
| Code Block | ||
|---|---|---|
| ||
class Point {
private final int x;
private final int y;
Point(int x, int y) {
this.x = x;
this.y = y;
}
void getPoint() {
System.out.println("(" + x + "," + y + ")");
}
}
|
...