Step1: Toggle / Enable breakpoint Set a breakpoint in the line of code or input point of the method from where you want to start debugging the code. Right-click on the left edge of the editor next to the line of code, and a context menu will appear. Select "Toggle Breakpoint" in the context menu
Step 2: setting a breakpoint to stop execution To start debugging, execution must stop at the specified breakpoint. To do this, click on the properties of the breakpoint and do the following:
1. Check Hit count 2. Specify value as 1 3. Select "Suspend thread" option
This will stop execution when the program hits the breakpoint.
Step 3: moving to the debugging perspective
In Eclipse, select Window -> Open Perspective -> Debug
Step4: Run in debug mode
Now run the program in debug mode. Choose Run → Debug
Now the program starts in debug mode, and you will see the status of the stream as "working"
When a program hits a breakpoint, the state of the thread changes from "running" to "suspied"
Step 5: Debugging Code Using \ Watch variables \ Inspect Expressions
Now the code stops at a breakpoint. You can use watch variables / expression to track the current value of a debug variable. Suppose you set a breakpoint in a variable called "counter" and the program stops at the counter variable. Add an expression with the variable name "counter" that allows you to track the value of the variable during program execution. You can also right-click on the counter variable and select “View” in the context menu If this is a method, select the name of the method and click “Step to Select”. This will allow you to track or debug the execution of the method line by line.
Step6: Use F6 Key To Go To Method
To "enter" the next executable line of code in the current method, press the "F6 Key". This will transfer control of the program from the current line to the next executable line of code.
user766038
source share