public static void Box()
{
String[] statement = new String [3];
Censor c = new Censor();
if(response.equalsIgnoreCase(yes))
{
System.out.print(name+": >>");
c.Replacement(statement[0]) = input.nextLine();
System.out.println(name+":" + statement[0]);
System.out.print(name+": >>");
c.Replacement(statement[1]) = input.nextLine();
System.out.println(name+":" + statement[1]);
System.out.print(name+": >>");
c.Replacement(statement[2]) = input.nextLine();
System.out.println(name+":" + statement[2]);
if(!statement[2].equals(empty))
{
System.out.print(name+": >>");
c.Replacement(statement[0]) = input.nextLine();
System.out.println(name+":" + statement[0]);
System.out.print(name+": >>");
c.Replacement(statement[1]) = input.nextLine();
System.out.println(name+":" + statement[1]);
System.out.print(name+": >>");
c.Replacement(statement[2]) = input.nextLine();
System.out.println(name+":" + statement[2]);
}
}
}
以上是嘗試調用Censor類,並在每個輸入中使用方法「替換」,以便用「****」替換Censor類中指定的單詞。爲什麼這個班級電話不工作?
我使用的編譯程序特別說明了「Censor c = new Censor();」是不可能的,因爲它找不到「符號:班級審查員」。這可能只是由於程序本身,但我只需要確定它是如何寫這個問題的問題。
這裏是有問題的Censor類。
public class Censor
{
public static void main(String[] args)
{
}
public static void Censore(String[] statement)
{
String[] words = new String[3];
Scanner blah = new Scanner(System.in);
words[0] = statement[0];
words[1] = statement[1];
words[2] = statement[2];
String replaceString = "";
int loopcount = 0;
while(loopcount < 1)
{
replaceString = words[0].replace("Blank", "****");
replaceString = words[0].replace("Seer", "****");
replaceString = words[0].replace("Nyah", "****");
System.out.println(replaceString);
}
}
}
Editted只是爲了擺脫的髒話
您是否導入了類審查員? –
我不認爲我做過......你所做的只是放入「進口檢查員」;在課程名稱正確之前? – Kat