✏️ Explanatory Question
An exception can be generated in three ways:
By the JVM (Java Virtual Machine) – for example, division by zero or accessing an invalid array index.
By the program code – using the throw keyword explicitly.
By calling a method that declares an exception in its throws clause.
Example:
throw new ArithmeticException("Division by zero");