Java中控制可见性的修饰符总结

Here is a summary of the four access modiers in Java that control visibility:

  1. Visible to the class only (private).

  2. Visible to the world (public).

  3. Visible to the package and all subclasses (protected).

  4. Visible to the package—the (unfortunate) default. No modiers are needed.

results matching ""

    No results matching ""