What is the use of package level protection in java?

前端 未结 15 1059
时光说笑
时光说笑 2020-12-05 14:28

I know how package level protection in java works. I read a lot of code (including lots of open source stuff) and no-one seem to be using it. The whole protection l

15条回答
  •  [愿得一人]
    2020-12-05 14:54

    I have objects that need access to one another. Within the package, they can call these protected methods,but when someone tries to access these protected methods, they are disallowed.

    In my opinion this is a basic protection mechanism, and a hierarchy of protection would be a nice feature.

提交回复
热议问题