Use a static method
when you want to be able to access the method
without an instance of the class
class scratch{
public static hey(){
System.out.println("Hey");
}
public static void main(String[] args){
hey();
//print Hey to the console
}
class StaticMethod
{
public static void main(String args[])
{
int num;
num=Math.min(21,12);
System.out.println("Minimum number is: " + num);
}
}