In this example i m not able to count "manoj" in the given string...how i can do this..
String text = "manoj kumjjjartiwarimanojmanoj";
char[] line = text.toCharArray();
char[] temp = "manoj".toCharArray();
int count=0;
for (int i =0; i < line.length; i++) {
int t =0;
for (int j = 0; j < temp.length; j++) {
if(line[i]==temp[j]){
t=1;
}
else{
t=0;
}
}
if(t==1){
count=count+1;
}
}
System.out.println(count);