java设置断点后有什么用,Eclipse的Java的断点 - 的目的是什么?

I'm working with the Android tutorial and I just got to the debugging section and I'm wondering what the purpose of a Breakpoint is. I can't tell just yet... is it actually stopping the app so I can be sure it runs up until that point, or can I set multiple breakpoints and use them as markers to "stop and go" from breakpoint to breakpoint checking my code?

解决方案

A breakpoint is a place where the execution stops, and you can start inspecting the current situation in your debugger. This includes:

the point has actually been reached

the current values of all variables

the ability to change manually all variables

the current stacktrace - i.e. which methods were executed before the current one

the ability to add and execute arbitrary code

the ability to inspect the results of a method invocation, while not actually proceeding with the execution

In addition to that, you can manually step forward, line by line in your application. There are three options:

step into - enters a method which is invoked in the current line

step over - goes to the next line

step return - returns from the current method (to the method that invoked it)

You can set multiple breakpoints if you have multiple places where you want to do any of the above.

Generally speaking, a debugger is a very upgraded version of using System.out.println(..) or log.debug(..) all over the place in order to make sure certain conditions are present. (thanks to BalusC for this point)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值