好象有个BEANINF类,能获得属性及方法名

解决方案 »

  1.   

    使用reflect技术就可以获得类的各种信息,并生成对象等,具体用法请搜索以前的帖子或在网上寻找简单教材
      

  2.   

    不知道你所说的“把在不同目录的a类装载到b类当中去”是什么意思,是指要在b类中创建a的实例吗?
      

  3.   

    import java.lang.reflect.*;
    import java.io.*;
    ...static void getInterfaceNames(Object o) {
        Class c = o.getClass();
        Class[] theInterfaces = c.getInterfaces();
        for (int i = 0; i < theInterfaces.length; i++) {
           Class cc = theInterfaces[i];         //get interface  
           String interfaceName = cc.getName(); //get name of interface
        }
    }
      

  4.   

    是啊~~~~要在b类中创建a的实例,调用用a类的方法~~~~
      

  5.   

    : yabbi21(yabbi21)  我看不懂你写的是什么意识,体会不来与我的问题的关系,我是要在b类中创建a的实例,然后调用用a类的方法~~~~如果a与b是在同一个文件就可以实现创建,但是在同一个目录就不幸了,因为他不能够创建a类的引用,接受产生的object对象,因为我创建a类的引用时,structure 的err中出现了can't resolve symbol class a.
    请指点,谢谢!!!
      

  6.   

    譬如:
    jb中有个工程:test下有个类:class hello(){
          hello(){}
          Methods(){}
    }    
    和类
    class ShowMethods{
       class c=Class.forname(hello);
       //怎么创建hello的对象;取得hello方法methods()
       //  hello   h;这样不行,因为hello与ehowmethods不在一个文件。}