Eclipse Java常用的输出调试技巧和Eclipse中的使用技巧

声明:本文参考自极客学院

1、syso+Alt+/:System.out.println("");

2、syse+Alt+/:System.err.println();
输出红色的错误信息

package control;

import javax.swing.JFrame;

public class DebugTest {

	public static void main(String[] args) {
		System.out.println(123456);
		System.out.println(true);
		System.out.println("this is String debug info");
		System.out.println(new JFrame() {
			@Override
			public String toString() {
				// TODO Auto-generated method stub
				return "This is a JFrame";
			}
		});
		System.err.println("this is String debug info");
		System.err.println();

	}

}

3、选中代码块,右键Surround with -> try/catch block
添加try/catch异常处理

注意:e.printStackTrace();可以打印错误,最好不要删掉

4、左侧行号双击,设置断点。
然后Debug,开始调试。
resume下一步

5、快捷键
Windows下:
Ctrl+1 或 光标移到错误处按F2:快速修复
Ctrl+z:撤销操作
Ctrl+d:快捷删除行
Shift+enter:跳转光标到下一行
Ctrl+F11:运行
Alt+上键/下键:快速移动行
Ctrl+Alt+上键/下键:快速复制行
Ctrl+m:将当前窗口放大
Alt+/:代码提示和自动补全
Ctrl+/:快速注释

设置在Preferences->General->Keys可以设置和查看快捷键。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值