Java exceptions

André Silva
3 min readApr 10, 2020

A program can fail for just about any reason. It’s normal.

Coding mistakes like trying to access an invalid index in an array or calling a method with a value that the method doesn’t support. Some of these are coding mistakes, others are completely beyond your control. What can we do to deal with this situations?


An exception is Java saying:

I don’t know what to do now!

Following scenario..

public class Salary { 

public static void main(String[]…