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