It is used to explicitly mention the way how the data (variables and methods of a class) will be available outside the scope.
An access specifier is something which mentions the way how the member of a class will be made available to anything outside the class.
An access specifier cannot be used with the local variables(i.e. present inside method/scope).
Access specifiers are the keywords using which we can control the accessibility of the members of a class.