instantiated to execute that method. They are not within the scope of the class, so
any class variables are not available in a static method.
Static methods are declared static by using the Static method modifier.
Static methods are called using the class name followed by two colons (::) and
then the methods name.
The following example shows a static method declaration, and a call to that static
method.
1 2 3 4 | static public void myStaticMethod() { } myClass::myStaticMethod() |
Best Regards,
Hossein Karimi
No comments:
Post a Comment