0
for(int g=0;g<vl.VerbsList.length;g++){ // primeiro loop ok
for(int h=0;h<TextParts.length;h++){ //segundo loop deveria ser executada por inteiro
for(int j =0;j<BaseWord.length();j++){
try{
if(BaseWord.charAt(j) == TextParts[h].charAt(j)){
System.out.println("BaseWord "+BaseWord);
System.out.println("TextParts "+TextParts[h]);
System.out.println("h "+h);
TempPoints += 1;
}
} catch(Exception e){
TempPoints = 0;
j = BaseWord.length();
}
}
//Ciclo Text Parts
if(TempPoints > Points) {
Word = TextParts[h];
TempPosition = h;
Points = TempPoints;
TempPoints = 0;
BaseWord = "";
System.out.println("Points: "+Points);
} else {
TempPoints = 0;
BaseWord = "";
}
}
//Ciclo de Verbal List
}
I want in an execution of that cycle:
for(int g=0;g<vl.VerbsList.length;g++){
The program runs this whole other cycle:
for(int h=0;h<TextParts.length;h++){
(The first is has to wait for the second to finish to continue)
So I can compare the characters of a text with the characters of the other text.
But the first is not waiting for the second to end
The value of "h" always and 0. That means she’s always starting over.
Where I went wrong?
(The topic code is not the complete code)
https://imgur.com/PmGw6gT (Textparts.length = 11)(Vl.VerbsList.length = 5000)
– Matheus Caffer
Look at these parts: Verbslist.length, Textparts.length, Baseword.length(). Can you see any difference?
– Silva Júnior
Post the entire code so we can test.
– Silva Júnior