Ad
  • Custom User Avatar

    What's the solution?

  • Custom User Avatar

    It's not boolean but Boolean ... so some items might be null. When you do if(arrayOfSheeps[i]) Java evaluates it as if(arrayOfSheeps[i].booleanValue() but because arrayOfSheeps[i] is null you get the null pointer