标签:nbsp ace trace style lin file bsp null java
java在允许期间可以通过Throwable类来获取方法调用堆栈信息;
部分方法如下:
Throwable e = new Throwable(); StackTraceElement[] stacks = e.getStackTrace(); if(stacks != null){ for(int i=0;i<stacks.length;i++){ System.out.println(stacks[i].getClassName()); System.out.println(stacks[i].getFileName()); System.out.println(stacks[i].getLineNumber()); System.out.println(stacks[i].getMethodName()); System.out.println("------------------------------------"); } }
标签:nbsp ace trace style lin file bsp null java
原文地址:https://www.cnblogs.com/biabiabia/p/10018978.html