Access Specifiers
Learn Access Specifiers (Java Basics, Java) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.
1. Introduction An access specifier (access modifier) is a keyword that decides who can see and use a class , field, method or constructor : private (same class only), default with no keyword (same package), protected (same package plus subclasses anywhere) and public (everywhere). The compiler checks them, and since Java 9 the module system adds a second gate so a public type in a non-exported package is unreachable from other modules.
More lessons in Java Basics
- Introduction to Java
- Getting Started with Java (Installation & Setup)
- Features of Java
- Difference between JVM, JDK, JRE
- Data Types and Variables
- Operators in Java
- Control Statements in Java
- Jumping Statements in Java
- Looping Statements
- Packages
- Array in Java
- Array Program
- String in Java
- Constructor in Java
- Constructor Chaining
- Static Keyword
- Input and Output Stream in Java
- Scanner in Java
- Serialization in Java
- Properties File in Java
- Final Keyword
- Wrapper Class
- Methods in Java
- Return Object from Method
- Different way to return to the method in java.
- This and Super Keywords