Pros and cons of package private classes in Java?

前端 未结 8 1799
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-27 05:05

I am learning Java recently, and I came across the notion of package-private classes, which is the default if we don\'t specify anything. But then I realized:

8条回答
  •  死守一世寂寞
    2020-11-27 05:39

    "Package Private" its used when you have several packages, and it means, other classes in the same package can access that class or class member as "public", classes in other packages cannot access, its like "private like them."

提交回复
热议问题