日期:2014-05-20  浏览次数:20731 次

一道简单的找错误作业题,高分请各位大侠帮忙!!!!!!!!!!!!!!!
找出程序错误并按程序原意修改为可正常运行的程序。
错误程序:
/**
  *   找程序错误                                                 错误描述:
  * 错误1: ……                     在JBuilder的项目HTML文档中;
  * 错误原因: ……                     或通过javadoc产生的HTML文档中;
  * 更正: ……
  * 错误n: ……
  * 错误原因: ……
  * 更正: ……
  *   找出程序错误,并根据程序意图在JBuilder中更正程序,通过编译并可运行。
  *   该程序为多次计算两个数之和,两个数通过键盘输入,加法通过继承接口的类完成。
  *   该程序源代码文件名为Test_Add.java
  */

public   class   Test_Add   {
    static   int   ARRAY_MAX_VALUE   =   10;
    static   int   ADD_XY_COUNT   =   10000;
    int   x,y,z;
    public   static   void   main(String[]   args)   {
        for(int   i=0;i <ADD_XY_COUNT;i++){
            byte[]   number1   =   new   byte[ARRAY_MAX_VALUE];
            byte[]   number2   =   new   byte[ARRAY_MAX_VALUE];
            char[]   c   =   new   char[ARRAY_MAX_VALUE];
            /*   读第一个数   */
            System.in.read(number1);
            c   =   (char)number1;
            System.out.println( "number1   =   "   +   c);
            x   =   number1;
            System.out.println( "x   =   "   +   x);
            /*   读第二个数   */
            System.in.read(number2);
            c   =   (char)number2;
            System.out.println( "number2   =   "   +   c);
            y   =   number2;
            System.out.println( "y   =   "   +   y);
            /*   计算X+Y   */
            AddXY   addxy   =   new   AddXY();
            z   =   addxy.AddXY(x,y);
            System.out.println( "   x   +   y   =   "   +   z);
        }
    }
}

public   class   AddXY   implements   TestInterface   {
    int   z;
    AddXY(int   x,int   y){
        z   =   x   +   y;
        return   z;
    }
}

public   interface   TestInterface   {
    int   z;
    int   AddXY(int   x,int   y){
        z   =   x   +   y;
        return   z;
    }
}