Your hitOrStayCounter
is 5
. And you are starting your loop from 5
.
for (int x = 0; x <= hitOrStayCounter; x++)
{
total = total + temp[x].getBJ();
}
If you are incriminating hitOrStayCounter
, then it's ok.
Make sure your temp object is inialized.
Card[] temp = new Card[300]; This will not initialize
This will create 300 variables. Like
Card c1;
Card c2;..
You have to allocate each object as temp[0]= new Card();
Do it in a loop. I am just giving example