3. Mechanism to control how one class can use other classes – fields, methods and the class itself The Java access specifiers public, protected, and private are placed in front of each definition for each member in your class, whether it’s a field or a method. Each access specifier only controls the access for that particular definition. Access control
5. If you don’t provide an access specifier, it means “package access.” All the other classes in the current package have access to that member. To all the classes outside of this package, the member appears to be private – not accessible class A { } Package
6. Create two classes (A, B) in home.default package Create a class (C) in package home.training package Create an instance of A in B Create an instance of A in C Exercise
7. When you use the public keyword, it means that the member declaration that immediately follows public is available to everyone, in particular to the client programmer who uses the library. public
8. Create two public classes (A, B) in home.default package Create a class (C) in package home.training package Create an instance of A in B Create an instance of A in C Exercise
10. The private keyword means that no one can access that member except the class that contains that member, inside methods of that class Other classes in the same package cannot access private members, so it’s as if you’re even insulating the class against yourself Can be changed without worrying that other parts of the system will be affected private void checkEven() {} private
11. Create a Java class X in pacakgetest.myprivate Create another class Y in same package with two methods one public and one private with the public method invoking the private method Create an instance of Y in X in a method peek In peek try to call the public and private methods of Y Exercise