How to select a string at the same position when randomly selecting a string in an array in Java?

Viewed 39

For example, I have arrays A and B.

String[] A= {"A", "B", "C", "D"},
        B= {"D", "C", "A", "B"};
int randomStoring = r.nextInt(A.length);
System.out.println("result: " + A[randomStoring]);

If C is randomly selected from array A, what is the method to get the value A from array B?

0 Answers
Related