用这种比较低级的方法 试试4.jcreator2.5中调试方法
jdb部分命令的使用
可能参考:F:\Net\java下载\CSDN的经典文摘\CSDN经典文摘1\JDB的简单使用.mht
1)设置断点
stop at debugtest.hehe:18
stop in debugtest.test.add2)打印变量
print bf.abc
print i
3)打印类变量
dump kk
4)list
显示当前的指针位置
5)locals
显示当前所有局部变量
5)执行后一句
next
6)单步进入
step
7)打印一个类的方法
methods test
8)打印一个类的成员变量
fields test
9)一直运行到下一个断点,如果没有,则运行到结束
cont
10)退出
quit例程如下:
package debugtest;
class test
{
int a;
int b;
test(int aa,int bb)
{
a = aa;
b = bb;
}
int add(){
int c=a+b;
return c;
}
}
public class hehe
{
public static void main(String args[])
{
int a = 2;
int b = 3;
int c= a+b; System.out.println("a= "+a);
System.out.println("b= "+b);
System.out.println("c= a+b= "+c);
test kk=new test(1,2);
System.out.println("kk.add()= "+kk.add());
}
}
jdb部分命令的使用
可能参考:F:\Net\java下载\CSDN的经典文摘\CSDN经典文摘1\JDB的简单使用.mht
1)设置断点
stop at debugtest.hehe:18
stop in debugtest.test.add2)打印变量
print bf.abc
print i
3)打印类变量
dump kk
4)list
显示当前的指针位置
5)locals
显示当前所有局部变量
5)执行后一句
next
6)单步进入
step
7)打印一个类的方法
methods test
8)打印一个类的成员变量
fields test
9)一直运行到下一个断点,如果没有,则运行到结束
cont
10)退出
quit例程如下:
package debugtest;
class test
{
int a;
int b;
test(int aa,int bb)
{
a = aa;
b = bb;
}
int add(){
int c=a+b;
return c;
}
}
public class hehe
{
public static void main(String args[])
{
int a = 2;
int b = 3;
int c= a+b; System.out.println("a= "+a);
System.out.println("b= "+b);
System.out.println("c= a+b= "+c);
test kk=new test(1,2);
System.out.println("kk.add()= "+kk.add());
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货