for (String cName : lnames)
{
for(int i = 0; i < uniquelname.length; i++)
{
if(cName.equals(uniquelname[i]))
{
//we want it to increase counter one
sCount[i]++;
itIsThere = true;
break;
}else{
itIsThere = false;
}
if (!itIsThere)
{
uniquelname[dynamicSize] = cName;
dynamicSize++;
}
}
for(int i = 0; i<sCount.length; i++)
{
if (maxCount < sCount[i])
{
maxCount = sCount[i];
maxIndex = i;
}
}
THE ERROR MESSAGE IM RECEIVING IS
WE IN THERECormier 1WE IN THERECormier 2Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 5
at Homework.main(Homework.java:48)
Bookmarks