HI, so my code compiles but does not give the result I intended. Any help is greatly appreciated!
public class SubstringCounter
{
public static int substringCounter(String master, String substring)
{ int count = 0 ;
for(int pos = 0 ; pos < master.length() ; pos++)
{
int index = master.indexOf(substring, pos) ;
if(index!=0){
pos = count ;
count++ ;
}
}
return count ;
}
}