-
Notifications
You must be signed in to change notification settings - Fork 0
Method
Keyhan Hadjari edited this page Sep 15, 2016
·
7 revisions
Describes the access level of a method. The list below is ordered from lowest to highest restriction level.
- public can be accessed from any class.
- protected can be accessed from within same class, sub classes and classes within same package.
- Default Also called Package private, can be accessed within same class or classes in same package.
- private can be accessed from within same class.
- abstract used in abstract classes, method has to be implemented in non-abstract subclasses.
- final cannot be overriden in subclasses.
- native The method points to code written in native languages like C/C++.
- static Class method or variable, can be accessed without initialization.
- strictfp Makes floating point calculations portable.
- synchronized thread safe method by locking it up during usage
The java type that is returned from the method, it could be a simple type like int or a Class object like String.