state the significance of public private


State the significance of public, private, protected, default modifiers both singly and in combination and state the effect of package relationships on declared items qualified by these modifiers.

Public: Public class is visible in other packages, field is visible everywhere (class must be public too)

Private : Private variables or methods might be used only by an instance of the similar class that declares the variable or method, A private feature might only be accessed by the class that owns the feature.

Protected: Is available to all classes in the similar package and also available to all subclasses of the class that owns the protected feature. This access is given even to subclasses that reside in a dissimilar package from the class that owns the protected feature.

What you get by default i.e. without any access modifier (ie, public private or protected). It means that it is visible to all within an exact package.

 

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: state the significance of public private
Reference No:- TGS0310969

Expected delivery within 24 Hours