Computer Applications
Given the following declarations:
final int SIZE = 20;
char[] name = new char[SIZE];
i. Write an assignment statement that stores 'D' into the first element of the array name.
ii. Write an output statement that prints the value of the tenth element of the array name.
iii. Write a for statement that fills the array name with spaces.
Related Questions
Write a code segment that finds the largest integer in this two-dimensional array.
int data[][] = new int[5][5];
What happens in Java if you try to access an element that is outside the bounds of the array?
Write a code segment to compute the sum of all positive real numbers stored in the following array.
double numb[] = new double[50];
Write Java statements for the following:
i. Create an array to hold 15 double values.
ii. Assign the value 10.5 to the last element in the array.
iii. Display the sum of the first and the last element.
iv. Write a loop that computes the sum of all elements in the array.