package test; 
class A{} package test; 
class B{} package test; 
(导入servlet所需包) 
class C extends HttpServlet { 
doPost(HttpRequest request,HttpResponse response){ 
A a = new A();//提示不能识别A; 
B b = new B();//提示不能识别B; 


A 与 C 同在 test目录下,classPath中也包括("."),怎么解决? A B 都是Bean,也没有定义带参数的构造函数。 帮帮忙,谢谢。

解决方案 »

  1.   

    你可以把含有 import test.*; 语句的类放在 test 目录的上一级目录中去试试,那么有可能不再出现这样的错误。仅供参考。
      

  2.   

    test.A a=new test.A();
    test.B b=new test.B();
      

  3.   

    AB是否已编译?我这么写没问题
    package test;
    class a{
    }package test;
    class b{
    }package test;class c{
    public static void main(String [] args){
    a aaa = new a();
    b bbb = new b();
    c ccc = new c();
    System.out.println ("aaa");
    }
    }
      

  4.   

    AB是否已编译?我做的没问题
    package test;
    class a{
    }package test;
    class b{
    }package test;class c{
    public static void main(String [] args){
    a aaa = new a();
    b bbb = new b();
    c ccc = new c();
    }
    }
      

  5.   

    A B 都已经编译过,photicx() 你试过没事么?我还是提醒不能识别!谢谢你帮忙我是编servlet所以必须在方法内实例化对象。还有别的办法么?再帮我想想办法,谢谢各位。
      

  6.   

    创建方法
    A类中
    public void A(){}
    b类中
    public void b(){}
      

  7.   

    谢谢各位我试一下看看我用的是tomcat5.0.28+windows2000+sqlserver2000 不会是这些组合的问题吧?