当前位置:首页 » 《随便一记》 » 正文

IDEA调试_PorscheYe 的博客

20 人参与  2022年06月04日 09:10  分类 : 《随便一记》  评论

点击全文阅读


IDEA调试

      • 1 调试界面各按钮的含义
      • 2 调试过程中修改变量的值
      • 3 快速定位bug
      • 4 实战

IDEA是Java常用的开发工具,这里记录一下IDEA调试相关操作。

1 调试界面各按钮的含义

在这里插入图片描述

2 调试过程中修改变量的值

在这里插入图片描述

3 快速定位bug

在这里插入图片描述

4 实战

可以通过下面的代码实际操作操作,以便更好地掌握。

public class DebugDemo1 {
    public static void main(String[] args) {
        f1();
        f2();
    }

    private static void f2() {
        for (char c = 0; c < 128; c++) {
            if (Character.isLowerCase(c))  {
                System.out.println(c);
            }
        }
    }

    private static void f1() {
        System.out.println("one");
        System.out.println("two");
        System.out.println("three");
        System.out.println("four");
        System.out.println("five");
    }
}
/*
1. 给出 exR1(6) 的返回值:
public static String exR1(int n) {
   if(n <= 0) return "";
   return exR1(n-3) + n + exR1(n-2) + n;
}

2.  给出 exR2(6) 的返回值:
public static String exR2(int n) {
   String s = exR2(n-3) + n + exR2(n-2) + n;
   if(n <= 0) return "";
   return s;
}
 */

public class DebugDemo2 {
    public static void main(String[] args) {
        System.out.println(exR1(6)); // 311361142246
        // System.out.println(exR2(6)); // StackOverflowError
    }
    
    public static String exR1(int n) {
        if(n <= 0) return "";
        return exR1(n-3) + n + exR1(n-2) + n;
    }

    public static String exR2(int n) {
        String s = exR2(n-3) + n + exR2(n-2) + n;
        if(n <= 0) return "";
        return s;
    }
}

点击全文阅读


本文链接:http://zhangshiyu.com/post/41336.html

调试  变量  过程中  
<< 上一篇 下一篇 >>

  • 评论(0)
  • 赞助本站

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

关于我们 | 我要投稿 | 免责申明

Copyright © 2020-2022 ZhangShiYu.com Rights Reserved.豫ICP备2022013469号-1