调试程序一般用的方法
2008-03-03 15:02
295 查看
1.我们为了得到程序相关信息,比如异常信息,我们会大量使用System.out.println();
2.测试时:
public class TestError {
public static void main(String[] args) {
MyDebug.println("测试代码正常运行");
}
}
class MyDebug{
public static boolean flag=true;
public static void println(String msg){
if(flag){
System.out.println(msg);
}
}
}
若不测试时:
public class TestError {
public static void main(String[] args) {
MyDebug.flag=false;
MyDebug.println("测试代码正常运行");
}
}
class MyDebug{
public static boolean flag=true;
public static void println(String msg){
if(flag){
System.out.println(msg);
}
}
}
3。使用第三方工具来调试!
2.测试时:
public class TestError {
public static void main(String[] args) {
MyDebug.println("测试代码正常运行");
}
}
class MyDebug{
public static boolean flag=true;
public static void println(String msg){
if(flag){
System.out.println(msg);
}
}
}
若不测试时:
public class TestError {
public static void main(String[] args) {
MyDebug.flag=false;
MyDebug.println("测试代码正常运行");
}
}
class MyDebug{
public static boolean flag=true;
public static void println(String msg){
if(flag){
System.out.println(msg);
}
}
}
3。使用第三方工具来调试!
相关文章推荐
- # include <errno.h >查看错误代码errno是调试程序的一个重要方法。当Linux C API函数发生异常时,一般会将errno变量赋值一个整数,不同的值表示不同的含义,可以通过查看
- Release和debug模式下调试跟踪程序的原则和方法 C#
- windbg调试masm生成程序的方法
- 编译、调试输入法程序的方法
- struts资源文件的配置及程序调试的方法-视频(包含所有中文乱码的解决方案)
- 单片机程序协助调试方法(一)串口调试(持续更新中)
- GDB调试中将信号发送给程序的方法
- ajax调用一般处理程序的多个方法
- Flex 4.0 在Flex Builder里调试程序的方法
- 用IIs调试程序可用的检查错误方法
- windows服务程序调试方法 - 启动直接进入调试
- 使用gprof调试Qt程序的方法
- linux gdb运行不下去的程序调试方法
- Linux 程序调试方法
- C# 一般处理程序后台传来参数作为方法Act
- GDB 调试带参数程序的方法int main(int argc,char *argv[])
- Ubuntu下使用Eclipse编译、调试嵌入式程序的方法(上)
- 功能调试的一般方法
- javaWeb-day01(程序的调试方法,配置快捷键)
- Windbg 内核态调试用户态程序然后下断点正确触发方法(亲自实现发现有效)