Java - Method accessibility inside package-private class?

前端 未结 2 1813
死守一世寂寞
死守一世寂寞 2021-01-11 18:25

If I have a java class which is package-private (declared with \"class\", not \"public class\"), there is really no difference if the methods inside are declared public or p

2条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-11 18:48

    Public methods inside a package class are public to classes in the same package. But, private methods will not be accessible by classes in the same package.

提交回复
热议问题