The most strict level of access control allowed in Java is
private . Any member variable or method marked as private will be only accessible in that class. But we might not need such a strong restriction all the time. So Java supports the other levels like default (no-modifier), protected , and public .
Please note that while
private , protected and public are keywords, the default access level is NOT a keyword. If we do not place either private , protected or public before a member variable or method, then it is automatically considered as default access level.
|