Pranav B.

asked • 08/25/19

How can I have an access to array elements from array of arrays?

Int a1= {1,2};int a2= {2,3}; int a3 [] [] = {a1,a2}; int r=(int) (Math.random() *a3.length); how can I have access to that a3 [r] stored in another array? Like-for (int p:a3[r]) {

SOP(p);

} how can I access p [0], p[1],only in Java.

1 Expert Answer

By:

Patrick B. answered • 08/25/19

Tutor
4.7 (31)

Math and computer tutor/teacher

Pranav B.

Thank you Sir for your answer but I am looking for a more simplified and generalized program. Instead of using for (p:a3[r]) loop what can I do to store the value of array a3( indexed 'r' )into another array.
Report

08/26/19

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.