Java Reference
In-Depth Information
Notice the
if
statement. If
i
is zero, then the outcome of the
if
is false, the division by zero
is prevented, and no result is displayed. Otherwise, the division takes place.
Chapter 5 Self Test
10 values you like.
4
.
Change the sort in
Try This 5-1
so that it sorts an array of strings. Demonstrate that it
works.
charAt( )
methods on this string literal: "I like Java".
string as the key.
11
.
Is it an error to overrun the end of an array? Is it an error to index an array with a neg-
ative value?
for
loop.