Source: http://www.imooc.com/video/1627
IDE Breakpoint Debugging Features
For example, the previous program, wrote the wrong, become the following
1 PackageCom.imooc;2 ImportJava.util.Scanner;//written behind the package3 4 Public classHelloWorld {5 Public Static voidMain (string[] args) {6Scanner input=NewScanner (system.in);//Create a Scanner object7System.out.print ("Please enter exam results information:");8 9 intScore = Input.nextint ();//get user-entered scores and save them in a variableTen One //variables are saved in addition to the number of times A intCount = 0; - - //print output plus pre-score theSystem.out.println ("Pre-bonus score:" +score); - - //as long as the score is less than 60, the loop performs the add-on operation and counts the number of points - for(; score + count <= 60; ) { +count++; - } + A //print output plus score, plus number of points atSystem.out.println ("Bonus score:" + (score +count)); -System.out.println ("A total of" +count+ "Times!")); - System.out.println (); - } -}
The result becomes:
Please input test results information: 8 Total added !
In fact, the score is not more than 61.
You can use the IDE to debug breakpoints at this time
Steps:
1. Set breakpoints
For example, set a breakpoint on the line where the loop is judged
To set a breakpoint, double-click on the left side of the row
For example, below the 18-row position, when you double-click Done, you can see that the position becomes a dot
Then click on the Debugger button, enter 53 after entering,
When you are prompted to open the Debug view (Confirm perspective Switch), you can tick the Remember option (Remember my decision) and click YES
The debug view opens as follows:
The source code page can see that the run-to-breakpoint position is paused: (the line code was not run the first time to the line breakpoint)
Single-Step Debugging:
Step over: The corresponding button is, can be single-step debugging
Once clicked, the current line runs and runs to the next line
Watch the Variable window view at this time
Continue stepping at this time, observing variable changes and results
Web-android Engineer first-5-4 using Eclipse debugger