How can you assign nondefault values to array elements when the array is declared? Give an example.
What will be an ideal response?
You can assign nondefault values to array elements at declaration by including a comma-separated list of values enclosed within curly braces. For example, if you want to create an array named myScores and store five test scores within the array, you can use any of the following declarations:
int[] myScores = new int[5] {100, 76, 88, 100, 90};
int[] myScores = new int[] {100, 76, 88, 100, 90};
int[] myScores = {100, 76, 88, 100, 90};
You might also like to view...
Image resolution refers to the number of ____________________ that can be displayed by the projection device.
Fill in the blank(s) with the appropriate word(s).
___________ are the two media features used over and over for responsive pages.
a. Min-orientation and max-orientation b. Min-width and max-width c. Min-scan and max-scan d. Min-grid and max-grid