Solved

Public Class CostArray

Question 12

Essay

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.

Correct Answer:

verifed

Verified

An out-of-bounds error is generated when...

View Answer

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions