Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

4th Edition

0805360476, 978-0805360479

More Books

Students also viewed these Databases questions