Solve Cannot make a static reference to the non-static method Error
Here you will learn to solve error “cannot make a static reference to the non-static method” or “non static method cannot be referenced from a static context”. Lets take one example where this error occurs. When you will compile below code then you will get an error.
1 2 3 4 5 6 7 8 9 |
public class DemoClass { void print() { System.out.println("Hello World"); } public static void main(String args[]) { print(); } } |
Why this Error Occurs? This error occurs …
Solve Cannot make a static reference to the non-static method Error Read More »