A method's visibility is known as method scope.



A method's visibility is known as method scope. We can say that it defines whether a object can invoke as well as any subclass can override the method or not. The scope are generally used as per the need of the program or application, e.g. if a method intended to be access only by the own class of the method then we make the visibility private

There are four type of scope or modifiers of method in java and all the scopes are as under:


Can be Accessed By

public The method can be access by any class.
protected The defining method can be access by the same package, class and subclass.
private This type of method can be invoked by the owner class.
No Modifier It also works as same as protected.
Share on Google+Share on Google+


Posted on: June 17, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles



Discuss: Scope  

Post your Comment

Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
April 18, 2011

No Scope Modified is NOT same as protected. It is stricter than protected. Subclass cannot access it, while protected can be accessed.
Christian B
July 13, 2012
not correct

No modifier is NOT the same as protected. It means it's package accessible (as in com.roseindia.*)
onalethata akoonyatse
March 27, 2013

i would like to learn everything about Java