web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :

Static Methods

Hossein.K Profile Picture Hossein.K 6,648
Static methods are attached to a class. However, they do not need that class to be
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:  static public void myStaticMethod()  
2: {
3: }
4: myClass::myStaticMethod()

Best Regards,
Hossein Karimi

Comments

*This post is locked for comments