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
You forget to write
package pkg1;
for Test2 class.
It should work now
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
.