WARNING - The static method test() from the type ClassName should be accessed in a static way

Warning

The static method test() from the type ClassName should be accessed in a static way

Sample Code 

class BuggyBread{
public static String method(){
return "String Method";
}
   public static void main(){
       BuggyBread bg = new BuggyBread();
       System.out.println(bg.method());
   }
}

Cause

Static method accessed using object reference offers very limited use -

1. Static method cannot access instance variables and hence cannot alter object state.

2. Static method in turn cannot call instance methods.

So the preferred way of accessing static method is either using Class name or through other static method and hence compiler warns you as you might have provided this call by mistake.