I would like to count the value of elements in my array.
Example:
Elements in the Array
a={"AB", "CD", "EF", "CD", "CD", "GH", "EF"}
so the counter for CD
should be 3.
Thats what I tried. I think the main Problem is that I have no Array where the Elements are stored.
public int countValue(final String[] strings, final String value)
{
int counter=0;
for(int i = 0; i<strings.length; i++)
{
if(value==strings[i])
{
counter++;
}
}
return counter;
}
}