Java public,default,private &protected modifiers
1. public members:-
If a member(variable or method) declared as public then we can access that member from anywhere.
But corresponding class should be visible or accessible so that before checking member visibility we have to check class visibility.
example:-
In the above example m1() method is public but we can't access from outside package corresponding class A is not public i.e. if both classes & method are public than only we can access the method from outside package.