INF/231 INF231 INF 231 WEEK 4 DISCUSSION 1

INF 231 WEEK 4  DISCUSSION 1

Discussion 1

 

Arrays

In Java, a data structure is a particular way of organizing data so that it can be used efficiently.  An array is a Java data structure. Define an Array and why you would use one. Provide an example that is not from the text.

What is the output of the following array code fragment:

int[] egArray = { 2, 4, 6, 8, 10, 1, 3, 5, 7, 9 };
for ( int index= 0 ; index < 5 ; index++  )
System.out.print(  egArray[ index ] + "  "  );

a.    2 4 6 8

b.    2 4 6 8 10

c.    2 4 6 8 10 1

d.    2 4 6 8 10 1 3 5 7 9

Guided Response: Review several of your peers’ posts. Respond to at least two of your peers. Compare your answers to the Array Loop code analysis, and evaluate your peers’ analysis identifying where you feel their answer is correct or not correct. Provide reasoning for your evaluative comments.

 

Answer Detail

Get This Answer

Invite Tutor