make an array with test grades of 80, 88, and 89
int [] testGrades = {80,88,89}
Example of for each loop
for (int number: numbers)
{
System.out.println(number);
}
a collection of values in an organized way
What is the output after this code snippet runs?
int[] scores = {80, 92, 91, 68, 88}; for(int i = 0; i < scores.length; i--) { System.out.println(scores[i]); }
ArrayIndexOutOfBoundsException
write an array of 5 integers called list
int list [] = new int [5];
Example of for loop
for (int i=0; i<nums.length; i++)
{
System.out.println(nums[i]);
}
What are the values organized by?
index
String[] words = new String[10];
words[0] = "dog";
words[3] = "cat";
words[2] = "pig";
out.println( words[0] );
out.println( words[3] );
out.println( words[7] );
--------
State the output
dog
cat
null
int [] arr = {7,2,5,3,0,10};
for (int k=0;k<arr.length-1;k++)
{
if (arr[k]> arr [k+1])
System.out.println(k + " " + arr[k] + " ");
}
0 7 2 5 3 3