9.3
February 14, 2008
rita1012
1. aWrite a loop that prints all of the items in an array a to the terminal screen. – int i = 0 for (i==0, i<a.length, i++) System.out.print(a[i]) 2. Repeat Question 1 put but print the items in reverse order. – int i = a.length – 1 for (i == a.length – 1; i>=0; i –) System.out.print(a[i])3. — int index; for (int i =0; i < a. length; i ++){ if (a[i] <0 ){ index = i; break; } else { index = a.length; } System.out.print (index) ;4. Describe what the following code segments do: a. It will change all the negative values of a to positive value by taking the absolute values of them. b. 5. What is the advantage of using the instance variable length variable length in a loop in a loop with an array. –
Entry Filed under: Uncategorized
Leave a Comment
Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
Trackback this post | Subscribe to comments via RSS Feed