Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Limiting the scope of classes, interfaces, methods and fields as far as possible reduces the chance of malicious manipulation. Restrictive access should be granted to limit the accessibility depending on the desired implementation scope. This also helps eliminate the threat of a malicious method overriding some legitimate method. The most restrictive condition is demonstrated in this compliant solution.

Code Block
bgColor#ccccff
private final class PrivateClass {
  private int x;
  private int y;
	
  private void getPoint() { //private constructor
     System.out.println("(" + x + "," + y + ")");  
  }	
}

...