Good day!
I am wondering How can I access an array index of an Object instance.
My code is as follows:
public class PokerPlayer {
private String name = null;
private Card [] cardsOnHand = new Card[5];
//getter and setter
}
What i want is to access the cardsOnHandArray[index] so that i can call it on another class and set the values per index...
public class PokerGame {
public static void main (String [] Args){
PokerPlayer players []= new PokerPlayer[4];
for(PokerPlayer player : players){
for(int i =0; i<5; i++){
//ACCESS cardsOnHand index i and store something on it...
}
}
}
}
Any advice would be highly appreciated. How can i also improve my OO design? Thank you in advance