Access Modifiers
Access Modifiers
8. Access Modifiers
1. Create a class with PRIVATE fields, private method and a main method. Print the fields
in main method. Call the private method in main method.
Create a sub class and try to access the private fields and methods from sub class.
2. Create a class with DEFAULT fields and methods. Access these fields and methods
from any other class in the same package
3. Create a class with PROTECTED fields and methods. Access these fields and methods
from any other class in the same package.
Also, Access the PROTECTED fields and methods from child class located in a different
package
Access the PROTECTED fields and methods from any class in different package
Access the public methods and fields from any class in the same package or different
package.
_____________________________________________________________________________________
JALA Academy offers Job Guarantee Programs, Income Earning Opportunities, and Internship with
stipend on Full Stack, MERN Stack, QA, Test Automation, RPA, Cloud Technologies, DevOps and Cyber
Security. Read our website JALA Academy for more details.