Difference between public private protected default Access Specifiers
What is the difference between public, private, protected and default Access Specifiers?
Answer : Through encapsulation you can control which part will have access to the member of a class. In java access specifiers are private, protected and public and it also defines default access level. Below table shows how these variable control access when define i the class: