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 클래스를 호출하고 각 입력에 "Replacement"메서드를 사용하여 Censor 클래스에 지정된 단어를 "****"로 바꿉니다.이 클래스 호출이 작동하지 않는 이유는 무엇입니까?
내가 사용하는 컴파일 프로그램은 구체적으로 "Censor c = new Censor();"라고 말합니다. "symbol : class Censor"를 찾을 수 없으므로 불가능합니다. 프로그램 자체 때문일 수도 있지만, 필자가 작성한 방법으로 문제가 발생했는지 확인해야합니다.
여기 Censor 클래스가 있습니다. 다른 패키지에 당신은 당신이
c.Replacement(statement[0])
및 전화 Import packagename.classname
.Another 일을 사용하여 가져와야의 경우 클래스에 대해서
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);
}
}
}
편집 해 그냥 없애 맹세 단어
Censor 클래스를 가져 왔습니까? –
나는 생각하지 않는다 ... 당신이하는 모든 것은 "수입 검열"이다. 수업 이름 전에 말이야? – Kat