这段代码中的构造方法又没有问题。

解决方案 »

  1.   

    此回复为自动发出,仅用于显示而已,并无任何其他特殊作用
    楼主【zhangbin55661】截止到2008-07-14 08:47:30的历史汇总数据(不包括此帖):
    发帖的总数量:8                        发帖的总分数:160                      每贴平均分数:20                       
    回帖的总数量:4                        得分贴总数量:0                        回帖的得分率:0%                       
    结贴的总数量:5                        结贴的总分数:100                      
    无满意结贴数:0                        无满意结贴分:0                        
    未结的帖子数:3                        未结的总分数:60                       
    结贴的百分比:62.50 %               结分的百分比:62.50 %                  
    无满意结贴率:0.00  %               无满意结分率:0.00  %                  
    楼主加油
      

  2.   

    mport java.io.*
    public class person
    {  int studentno;
       int teacherno;
       char studentname[]=new char[20];
       char teachername[]=new char[20];
       int  ;
     person(int studentno,char studentname[20],int )
       {    this studentno=studentno;
            this studentname[20]=studentname[20];
            this =;
             System.out.println(studentno,studentname[20],);
        } person(int teacherno,char teachername)
        {   this teacherno=teacherno;
            this teachername[20]=teachername[20];
             System.out.println(teacherno,teachername[20]);
         }
       
     
      public static void main()
         { int x,z;
          char y[]=new char[20];
          System.out.println("input");
         person r=new person(x,y[],z);
         person r1=new person(x,y[]);      }
    }
         
          忘发了.
      

  3.   

    有问题
    参数里char studentname[20]什么意思? 
      

  4.   

    你试试
    import java.io.* ;
    public class person 
    {  int studentno; 
      int teacherno; 
      char studentname[]=new char[20]; 
      char teachername[]=new char[20]; 
      int  ; 
    person(int studentno,char[] studentname,int ) 
      {    this.studentno=studentno; 
            this.studentname[20]=studentname[20]; 
            this.=; 
            System.out.println(studentno+","+studentname[20]+","+); 
        } person(int teacherno,char[] teachername) 
        {  this.teacherno=teacherno; 
            this.teachername[20]=teachername[20]; 
            System.out.println(teacherno+","+teachername[20]); 
        } 
        public static void main() 
        { int x = 0,z = 0; 
          char y[]=new char[20]; 
          System.out.println("input"); 
        person r=new person(x,y,z); 
        person r1=new person(x,y);       } 

      

  5.   


    import java.io.*;public class Person {    int studentno;
        int teacherno;
        char studentname[] = new char[20];
        char teachername[] = new char[20];
        int ;    public Person(int studentno, char studentname[], int ) {
            this.studentno = studentno;
            this.studentname = studentname;
            this. = ;
            System.out.println(this.studentno + " " + this.studentname + " " + this.);
        }    public Person(int teacherno, char teachername[]) {
            this.teacherno = teacherno;
            this.teachername = teachername;
            System.out.println(this.teacherno + " " + this.teachername);
        }    public static void main() {
            int x, z;
            char y[] = new char[20];
            System.out.println("input");    }
    } 先把语法搞清楚再写代码吧。
      

  6.   

    this.studentname[20]=studentname[20]; 这就是个语法错误。
    大小为20,访问下标为20的元素,怎么会没问题?
      

  7.   

    存名字为什么不用String 类型呢?感觉比你那Char[20]好得多!
      

  8.   

    楼主 C 转过来的吧,还是好好学学 Java 吧。public class Person { private int studentno;
    private int teacherno;
    private String studentname;
    private String teachername;
    private int ; public Person(int studentno, String studentname, int ) {
    this.studentno = studentno;
    this.studentname = studentname;
    this. = ;
    System.out.println(studentno + studentname + );
    } public Person(int teacherno, String teachername) {
    this.teacherno = teacherno;
    this.teachername = teachername;
    System.out.println(teacherno + teachername);
    } public static void main(String[] args) {
    //int x,z;
    //char y[]=new char[20];
    //System.out.println("input");
    Person r = new Person(1, "", 1);
    Person r1 = new Person(2, "");
    }}