我真的需要幫助修復此行我的代碼,我不斷收到這兩個錯誤:Java遞歸生成錯誤:需要數組,但找到字符串?
第一個錯誤:要求數組,但字符串發現 如果(x.length()== 0 & & y.length( )> 0 & & y [0] ==「*」)
第二個錯誤:找不到合適的方法替換(int,int)String newY = y.replace(0,1); 任何幫助,將不勝感激
//Second string is empty and there is wildCard character
if(y.length() == 0 && wildCard)
{
return true;
}
if(x.length() == 0 && y.length() > 0 && y[0] == "*")
{
String newY = y.replace(0,1);
return match(x, newY, true);
}
'newY'是一個'String',而你的'match'方法需要一個數組。 –