Question: In problems 5 - 9 an operation is performed with the ordinary array ary. Write equivalent code that performs the same operation on the ArrayList

 In problems 5 - 9 an operation is performed with the

In problems 5 - 9 an operation is performed with the ordinary" array ary. Write equivalent code that performs the same operation on the ArrayList object called a. Assume that Java 5.0+ is being used and give two answers for each problem (parts A and B). For A part assume that a was created with List a = new ArrayList(); and for B part assume List(); was used: 5. int x = 19; ary[5] = x; 6. int gh = ary[22]; 7. int szary.length; 8. int kd - ary[1011 ary[101] - 17; Use the set method: 9. //Before inserting a new number, 127, at position 59, it will be necessary to move all //up one notch. Assume that the logical size of our array is logicalSize. for(int j = logical Size;j >-59.j--) { ary(+1) = ary[i]; } ary[59] - 127; //insert the new number, 127, at index 59. What code using List method(s) does the equivalent of the above code

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!