你没有实例化,当然不能运行了.
加上counter c = new counter(); 
c.ReadFile("1.txt");

解决方案 »

  1.   

    又是一个在main方法(静态)中调用非静态方法的错误。
    把ReadFile(***)方法生命为静态的就可以了。
      

  2.   

    实例化或者把ReadFile()声明为静态
      

  3.   

    三种方法
    1。counter c = new counter(); 
    c.ReadFile("1.txt");
    2。this.ReadFile("1.txt");
    3.声明为static类型public static String ReadFile(String filePath) throws FileNotFoundException