Q:

How do I pass a value from a container A to a container B?

Probably Im not explaining well. For example, I have a cup A with balls 1, 2 and 3 and a cup B with balls 4, 5 and 6. How can build the program for you to choose any ball from the cuup A and take it to the cup B.
I have understood that it would start like this:
int N,a[]={1,2,3}, b[]={4,5,6};

with N as the ball you will move.
Sorry for my bad english, thanks.

A:

Use e.g. an ArrayList, and not an int[].
Then do something like this:
Random randomGenerator = new Random();
int randomIndexA = randomGenerator.nextInt(A.size());
int elemA = A.get(randomIndexA);

This way you get elemA which is a random element from the list A.
You can do the same with list B.
Then you can move around the elements you got anyway you like.

