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
Get step-by-step solutions from verified subject matter experts
