Java符号错误

Java符号错误,java,Java,我在第44行一直收到这样的“错误:找不到符号”,我不知道我缺少了什么符号。我确信我所有的变量都已声明。有人能帮我找到代码中的问题吗 class personne{ private String naissance; private int nbCafe; public personne(String year, int number){ naissance=year; nbCafe=number; } public per

我在第44行一直收到这样的“错误:找不到符号”,我不知道我缺少了什么符号。我确信我所有的变量都已声明。有人能帮我找到代码中的问题吗

class personne{
    private String naissance;
    private int nbCafe;

    public personne(String year, int number){
        naissance=year;
        nbCafe=number;
    }
    public personne(String year){
        naissance=year;
        nbCafe=1;
    }

    public String getnaissance(){
        return naissance;
    }
    public int getnbCafe(){
        return nbCafe;
    }
    public void afficher(String message){
        System.out.println(message+ ": nee le 16 novembre 1994, consomme 2 tasse(s) de cafe");
    }

    public void affichertable(personne [] table, int amount,String message){
        System.out.printf("Contenu du tableau de %d personne(s) %s", amount,message);
            System.out.printf("Naissance     nbCafe");
        for (int i=0; i<amount;i++)
            System.out.printf("%6.2s    %8.2d\n", table[i].getnaissance(), table[i].getnbCafe() );


    }
}

public class popo{
    public static void main(String args[]){
        personne p1= new personne("16/11/1994",2);
        personne p2=new personne("15/12/1990");

        p1.afficher("Informations de p1");

        personne[] pers={ new personne("12/10/1991",3),new personne("15/10/1990",6), new personne("13/07/1993",3), new personne("05/06/1991"),new personne("16/12/1992",3)};    
        int nbpers=pers.length;

        affichertable(pers,nbpers,"premier tableau");//This is line 44 where the error occurs
    }
}
class人员{
私有字符串的诞生;
私人国际nbCafe;
公共人员(字符串年份,整数){
出生=年;
nbCafe=数量;
}
公共人员(连续一年){
出生=年;
nbCafe=1;
}
公共字符串getnaissance(){
回归诞生;
}
public int getnbCafe(){
返回nbCafe;
}
公共无效附加器(字符串消息){
系统输出打印(信息+“:nee le 16 Novenbre 1994,consomme 2 tasse(s)de cafe”);
}
公共void词缀表(personne[]表,整数金额,字符串消息){
System.out.printf(“人员%d的表格内容”、金额、信息);
System.out.printf(“Naissance nbCafe”);

for(int i=0;i
affichertable
personne
中的一个实例方法。您试图将其称为
popopo
中的一个静态方法

您应该猜测一下调用
p1.affichertable(…)
p2.affichertable(…)

或者,如果
affirchertable
方法不依赖于
personne
的单个实例的状态,则应将其更改为静态方法,并将其称为:

personne.affichertable(...);

(顺便说一句,我强烈建议您遵循普通的Java命名约定,将类名大写,并将不同的类放在不同的源文件中。)

affichertable
personne
中的一个实例方法。您试图调用它,就好像它是
popo
中的一个静态方法一样

您应该猜测一下调用
p1.affichertable(…)
p2.affichertable(…)

或者,如果
affirchertable
方法不依赖于
personne
的单个实例的状态,则应将其更改为静态方法,并将其称为:

personne.affichertable(...);

(顺便说一句,我强烈建议您遵循普通的Java命名约定,将类名大写,并将不同的类放在不同的源文件中。)

affichertable
personne
中的一个实例方法。您试图调用它,就好像它是
popo
中的一个静态方法一样

您应该猜测一下调用
p1.affichertable(…)
p2.affichertable(…)

或者,如果
affirchertable
方法不依赖于
personne
的单个实例的状态,则应将其更改为静态方法,并将其称为:

personne.affichertable(...);

(顺便说一句,我强烈建议您遵循普通的Java命名约定,将类名大写,并将不同的类放在不同的源文件中。)

affichertable
personne
中的一个实例方法。您试图调用它,就好像它是
popo
中的一个静态方法一样

您应该猜测一下调用
p1.affichertable(…)
p2.affichertable(…)

或者,如果
affirchertable
方法不依赖于
personne
的单个实例的状态,则应将其更改为静态方法,并将其称为:

personne.affichertable(...);


(顺便说一句,我强烈建议您遵循正常的Java命名约定,将类名大写,并将不同的类放在不同的源文件中。)

错误消息会告诉您哪个符号。在这种情况下,这是
affichertable
,它没有在
popopo
中声明。请尊重命名约定。但是这个方法不是已经在类中声明了吗?我基本上只是在main中调用它而已?@user3268216:不,您这里有两个不同的类-
popopopo
(包含
main
)和
personne
(包含
附件
)。它们在同一个源文件中声明的事实无关紧要。错误消息会告诉您哪个符号。在这种情况下,即
affichertable
,它未在
popo
中声明。请遵守命名约定。但该方法是否已在类中声明?我基本上只是在main中调用它?@user3268216:不,这里有两个不同的类-
popo
(包含
main
)和
personne
(包含
affichertable
)。它们在同一个源文件中声明的事实无关紧要。错误消息会告诉您哪个符号。在这种情况下,即
affichertable
,它未在
popo
中声明。请遵守命名约定。但该方法是否已在类中声明?我基本上只是在main中调用它?@user3268216:不,这里有两个不同的类-
popo
(包含
main
)和
personne
(包含
affichertable
)。它们在同一个源文件中声明的事实无关紧要。错误消息会告诉您哪个符号。在这种情况下,即
affichertable
,它未在
popo
中声明。请遵守命名约定。但该方法是否已在类中声明?我基本上只是在main中调用它?@user3268216:不,这里有两个不同的类-
popopo
(包含
main
)和
personne
(包含
affichertable
)。它们在同一个源文件中声明的事实与此无关。我尝试了personne.affichertable,它似乎可以工作,但在打印表时遇到一些困难“错误:非静态方法”。是的,我的老师告诉我,如果我不大写我的类名,程序员会多么讨厌我。@user3268216:如果你遇到错误,它就不起作用了——你需要将它变成一个静态方法(正如我在回答中所描述的)。是的,我这样做了,但它是错误的