Question: public class CostArray { public static void main(String[] args) { double[] costs = new double[3]; costs[0] = 5.00; costs[1] = 7.00; costs[2] = 9.00; System.out.println(costs[3]);

public class CostArray

{

public static void main(String[] args)

{

double[] costs = new double[3];

costs[0] = 5.00;

costs[1] = 7.00;

costs[2] = 9.00;

System.out.println(costs[3]);

}

}

?

Once the above code is compiled and executed, an error message is generated. Explain the error message that will result and explain the reason for the error.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!