How to initialize an array in Java?
data[10] = {10,20,30,40,50,60,71,80,90,91}; The above is not correct (syntax error). It means you are assigning an array to data[10] which can hold just an element. If you want to initialize an array, try using Array Initializer: int[] data = {10,20,30,40,50,60,71,80,90,91}; // or int[] data; data = new int[] {10,20,30,40,50,60,71,80,90,91}; Notice the difference between the two … Read more