You can write and call your own methods too. Methods begin with a declaration. Method consists of the following parts.
- Access Specifier public: This method can be called from anywhere. private: This method can be called or used within the class where it is defined. protected: This method can be used anywhere within the package in which it is defined.
- Static or Dynamic method Static methods have only one instance per class rather than one instance per object. All objects of the same class share a single copy of a static method. By default methods are not static.
- Return Type
No comments:
Post a Comment