what is the use of using static methods in java code example
Example 1: do i have to use static methods in java main
Use a static method
when you want to be able to access the method
without an instance of the class
Example 2: how to call a static method in java
class scratch{
public static hey(){
System.out.println("Hey");
}
public static void main(String[] args){
hey();
//print Hey to the console
}