My code is compiling but I am getting the following error: "Index 3 out of bounds for length 3". I will appreciate if someone can please help me understand what I did wrong.
import stdlib.StdOut;
public class Lista {
public static void main(String[] args) {
double x = {0.30, 0.50, 0.10};
double y = {0.60, 0.10, 0.40};
double sum = 0.0;
for (int i = 0; i <= x.length; i++)
for (int j = 0; j <= y.length; j++)
sum += x[i] * y[j];
StdOut.println(sum);
}
}