int[] numbers = {2,3,4,5,6};
return numbers;
methods used to print array
1.printArrays(); this method print array.
2.toString(); // this method print the string representation of array.
method to fill Array
1.fill(); // this method fill the whole array. example: string[] names = new string[3] // this create an array object in the computer memory.
Arrays.fill( string, “matthew”); // this method fill the array with the value/data matthew.
2.fill(array,fromindex, toindex, value); // this method fill the array at a specific index.
Sum += number[i] // this is how we get the sum of the element in an array.
product *= number[i] // this is how we get the product of the element in an array.
double average = double(sum) / number.length;
if(searchElement == number[i])
// this search the element in an array. and see if searchelement is equal to the element in the array.
we can pass a primitive and non primitive to a method at the same time.
example: (int[] numbers, int n );