I would like to Rewrite the getContents method below to incorporate exception handling. In particular, when an ArrayIndexOutOfBoundsException is generated, the method should return the value -1.0
public class Four
{
private double [] numbers = {1.0, 2.0, 3.0, 4.0};
public double getContents(int index)
{
return numbers[index];
}
}