Why the method "div" doesn't work without static.? when just remove the static keyword it gives me the Error i.e .."\Playground:13: error: non-static method div(int, int) cannot be referenced from a static context System.out.println(div(42, 0));"
public class Program {
static int div(int a, int b) throws ArithmeticException {
if(b == 0) {
throw new ArithmeticException("Division by Zero");
} else {
return a / b;
}
}
public static void main(String[] args) {
System.out.println(div(42, 2));
}
}