Scope
Posted on: June 17, 2009 at 12:00 AM
A method's visibility is known as method scope.

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:

Modifier

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.

Related Tags for Scope:
cideclassobjectmethodoverrideidsubclassinvokedefineeitnotcaninnosubasmcajclesovermeobjssudefinesatanykhallsassrithbchatfinjeo


More Tutorials from this section

Ask Questions?    Discuss: Scope  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.