as you can see, probably I exaggerated this topic. Here is the what i need;
I have a 5-6 classes. and i simulating , when this classes meeting on same location, if they same class with opposite gender, they will be mate. and a baby will born with same class.
But i confused here. I am matching classes with ArrayList and for loop (i and j nested loop).
that's what i need ;
if(male Xclass matches female Xclass){ //actually here i dont know classes
Xclass x = new Xclass(); // i have just elements i and j
list.add(x);
} // something like that , but how can i know which class they have and how
// can i create a new class while i don't know this.
**Sorry for bad english, Thank you :)
EDIT: I meant same class with different gender; there are classes A,B,C,D and gender is just variable (private int Gender; //1 for male,0for female and it is random value , 1 or 0) i have a also loctaion x,y class. male A and male A cant mate male A and female A can mate male B and female C cant mate i mean this. sorry for bad experession
So do you mean like this (it's disturbing)? It's weird what you mean by classes of the same type and then different. From your example you only have one class. If I understand correctly you want to model something like this.
Then you could do something like: