肯定不能识别!
getcount()是谁的方法?
在哪里定义的?

解决方案 »

  1.   

    呵呵,看看后面的注释
    count = getCount(); // a method defined in the program
    估计只是一个说明性的例程而已,当然无法运行
    注意E文水平也要提高啊
      

  2.   

    public class nihao{
     public static void main(String args[]){
     int count;
     GetCnt getCnt = new GetCnt(); //new object
     count = getCnt.getcount(); // a method defined in the GetCnt
     if (count < 0) {
     System.out.println("Error: count value is negative.");
     } else {
     System.out.println("There will be " + count +
     " people for lunch today.");
    }
    }
    }class GetCnt
    {
    private int other_count = 8;

    int getcount()
    {
    return other_count;
    }
    };
      

  3.   

    是类class GetCnt里的方法
    他的作用是返回一个值另外我觉得楼主一开始的父类应该是这样的吧
    public class Nihao
      

  4.   

    public class nihao{
     public static void main(String args[]){
    int count;
     count = getCount(); // a method defined in the program
     if (count < 0) {
     System.out.println("Error: count value is negative.");
     } else {
     System.out.println("There will be " + count +
     " people for lunch today.");
    }
    }/**
     * @return
     */
    private static int getCount() {
    return 0;
    }
    }