Write a program segment that declares an array variable cons
Write a program segment that declares an array variable, constructs an array object, assigns the
array object to the array variable, and then uses a loop to fill the array with the following integers.
-50, -40, -30, -20, -10, 0, 10, 20, 30, 40, 50.
Solution
int[] arr; //array declaration
arr = new int[11]; // creates array object and assign to arr variable.
int starting_value = -50;
for(int i=0;i<11;i++) //assigns values to the array
{
arr[i] = starting_value;
starting_value = starting_value+10;
}
