Static Method In Java Example
Chapter:
Miscellaneous
Last Updated:
19-07-2016 03:04:27 UTC
Program:
/* ............... START ............... */
public class JavaStaticMethod {
public static void main(String[] args) {
welcome();
}
static void welcome() {
System.out.println("Welcome to JavaScan.com.");
}
}
/* ............... END ............... */
Output
Notes:
-
Static methods in Java can be called without creating an object of class.
- The static keyword in java is used for memory management mainly.
- The static variable gets memory only once in class area at the time of class loading.
Tags
Static Block, Java