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
|
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. |
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.
Ask Questions? Discuss: Scope
Post your Comment