Java Package level access

前端 未结 2 1695

I know that class members with default access control can be accessible at package level but i\'m confused about what does package level access actually mean. If default mem

2条回答
  •  时光取名叫无心
    2021-01-20 01:09

    Package level access means that only classes that are defined in the same package can access the package level variable. If you have to import Test, then I'm assuming that Test is in a different package and therefore it can't access i.

    For Test2 to access i, define it in the same package as Test1.

提交回复
热议问题