Java Interview Question

Use this basic question and answer to prepare for your next Java interview.

What happens if the main method is not static?


If a program has a main method without the static keyword, it will compile, but will throw a Runtime Exception with NoSuchMethodError.

Looking for developers?