+ 1
Multiple exceptions: what does static keyword mean here ?
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, 0)); } }
1 Answer
+ 5
There is no relation with static and exceptions. Both are different things.
static means store data in memory when jvm start. static method does not need instance means you can access without any instance of class.