I've got a problem with my Java program. There is an error in my code on line 16 (t = T[i];) which implies an error on line 12. It says :
Syntax error on token "=",VariableInitializer expected after this token.
Could I have some help ?
public class Ngrams {
public static boolean estPrefixe(String t, String s) {
int Longs = s.length();
if (t.substring(0, Longs) == s) {
return true;
} else {
return false;
}
}
public static int nbOccurences(String[] T, String s) {
int compteur = 0;
String t = null;
for (int i = 0; i < T.length; i++) {
t = T[i];
if (estPrefixe(t, s)) {
compteur++;
}
return compteur;
}
}
==, use proper caseString.startsWith}missing. I may have accedently fixed the code when trying to fix the formatting.