by
[Exercise |
API Docs |
Short Course|
Exercises]
|
Define the array, but don't assign anything to it.
Use a for loop to set the values of the array to the index plus 10.
To access the elemetns of the array, use the loop index, as in this example:
for(int i = 0; i < 5; i++) {
myarray[i] = 0;
}
Use a for loop to print out the values in the array.
To print a string, do this:
System.out.println("msg");
Make an array of strings initialized to Frank, Bob, and Jim using the variable initializer syntax.
The initalization expression should be:
{ "Frank", "Bob", "Jim" }
Use a for loop to print out the strings in the array.
This is similar to printing out integers.
Task 6
Set the last element of the array to Mike.
The string literal here should be "Mike"
Task 7
Print out the last element in the array.
The last index of an array is always one minus the length of the array.
Copyright 1996-2000 jGuru.com. All Rights Reserved.
|
| ||||||||||||