Organizational Research By

Surprising Reserch Topic

What are access modifiers?


Access modifiers decide whether a method or a data variable can be accessed by another method in another class or subclass.
four types of access modifiers:
Public: - Can be accessed by any other class anywhere.
Protected: - Can be accessed by classes inside the package or by subclasses ( that means classes who inherit from this class).
Private - Can be accessed only within the class. Even methods in subclasses in the same package do not have access.
Default - (Its private access by default) accessible to classes in the same package but not by classes in other packages, even if these are subclasses.
 
asked Sep 13, 2013 in oops by rajesh
edited Sep 12, 2013
0 votes
14 views



Related Hot Questions



Government Jobs Opening


...