还有一个问题就是如何知道我这个类需要调用哪些类呢?

解决方案 »

  1.   

    Eclipse里,选中类名或方法,右键,reference,project即可以知道了。
      

  2.   

    看你使用社么IDE了~~
    我提供个JBUILDER的吧
    变量或类名 find define  向上
    find location reference  向下
    LZ研究下IDE就好了
      

  3.   

    在class文件里应该有这些信息,我们做过一个这样的小工具,就是解析class文件。
      

  4.   

    应该是我没有说清楚.我的意思是如何用程序来实现.To:monsterMao() 
    不知道你能否把你的代码给我一份呢?
    [email protected]
    或者你说说思路也可以.
      

  5.   

    如何知道方法的调用者 public static String getCaller(){   
       int i;   
       StackTraceElement stack[] = (new Throwable()).getStackTrace();   
       for (i=0; i < stack.length; i++) {   
         StackTraceElement ste=stack[i];   
           System.out.println(ste.getClassName()+"."+ste.getMethodName()+"(...)");   
         System.out.println(i+"--"+ste.getMethodName());   
         System.out.println(i+"--"+ste.getFileName());   
         System.out.println(i+"--"+ste.getLineNumber());   
       }   
     }
      

  6.   

    如果我只有class文件要怎么才能知道这个类里的方法被哪些类使用和要怎样知道这个类使用了哪些其他类里的方法呢?
      

  7.   

    反编译?然后看调用了谁.
    至于谁调用了他~~class文件里又没记录
      

  8.   

    jbuilder2007有代码->uml的功能,生出uml后就很清楚了
      

  9.   

    查找吧,class里不会记录这些信息
      

  10.   

    to:journay
    那生成的uml是通过搜索所有源代码来得到一个类与其他类之间的关系的吗?
      

  11.   

    看生成的uml的包、类图,上面有各个类之间的关系