我遇到了一些麻烦PrintWriter
,它在循环之外工作for
,它确实打印了“Test1”和“Test2”,但它没有在里面打印“example 1”If
当我用调试器检查它时,代码行被执行
File file = new File ("output.txt");
FileWriter wri;
try {
wri = new FileWriter(file);
PrintWriter writer = new PrintWriter(wri);
writer.println("Test1");
boolean result=false;
for(i=0;i<this.lung;i++){
for(j=0;j<this.lung;j++){
if(wordToFind.charAt(0)==mat[i][j]){
if((i>=wordLength-1)&&(results!=true))
if (wordToFind.charAt(1)==mat[i-1][j])
if(result=continue(i,j,i-1,j,1))
writer.println("example 1");
/*Same if as the above but with differente parameters are down here*/
}
}
}
}
writer.print("Test2");
writer.close();
} catch (IOException e) {
System.out.println("Error: " + e);
}