inotgo.com

Step 1 : Prepare a paragraph Java code   
Step 2 : Set breakpoint   
Step 3 : Click the debug button   
Step 4 : Confirm switching to debugging Perspective   
Step 5 : Switch back to development Java Coded Perspective   
Step 6 : Debug Perspective   
Step 7 : Single step operation   
Step 8 : Look at the upper right corner Variables Change of   
Step 9 : sign out   

Step 1 :

Prepare a paragraph Java code

edit top fracture
This is a for Cyclic Java code , It is helpful to observe the effect of setting breakpoints
public class HelloWorld { public static void main(String[] args) { int moneyEachDay = 0; int day = 10; int sum=0; for (int i = 1; i <= day; i++) { if(0==moneyEachDay) moneyEachDay = 1; else moneyEachDay *= 2; sum+=moneyEachDay; System.out.println(i + " Days later , The total amount of money in the hands of Lord Hong Gang is : " + sum ); } } }
public class HelloWorld {
    public static void main(String[] args) {
 
        int moneyEachDay = 0;
        int day = 10;
        int sum=0;
        for (int i = 1; i <= day; i++) {
            if(0==moneyEachDay)
                moneyEachDay = 1;
            else
                moneyEachDay *= 2;
             
            sum+=moneyEachDay;
             
            System.out.println(i + "  Days later , The total amount of money in the hands of Lord Hong Gang is : " + sum );
        }
    }
 
}
Breakpoint concept : A breakpoint is when you are in debug mode , When the code runs to the breakpoint , Will stop , It is convenient for developers to observe relevant data , Analyze the code logic , Troubleshooting .

There are several ways to set breakpoints , For example, set a breakpoint on line 8
1. In line number 8 That position , Right click the mouse , Then select Toggle Breakpoint You can add or delete breakpoints
2. In line number 8 That position , You can also add or delete breakpoints by double clicking the left mouse button .
3. Menu ->Run it's fine too , Not commonly used , No mouse is convenient .
 Set breakpoint
At ordinary times, use the left side of the run button , There's a bug button , namely debug Button .
Click to debug .
notes : It should be noted that , Current class , There must be a master method , Otherwise, it will debug to Last successful program
 Click the debug button
Step 4 :

Confirm switching to debugging Perspective

edit top fracture
If this is the first run , A dialog box will pop up asking if you want to switch to debugging , click YES.
 Confirm switching to debugging Perspective
Step 5 :

Switch back to development Java Coded Perspective

edit top fracture
Click in the upper right corner Debug lateral Java, You can switch back to the original familiar Java Development environment
 Switch back to development Java Coded Perspective
Debugging vision , What needs attention is that 4 Regions
1. Which thread is currently , Because it's a non multithreaded program , So it's the main thread
2. The values of several variables that affect the operation of line 8 , This is the main function of debugging , Observe how much of these values , Analyze the problem or understand the code logic
3. Current code , express You're about to run line 8 , But I haven't had time to run line 8 yet
4. console output

There are other areas , Not commonly used
 Debug Perspective
Click this button , You can execute it line by line , Or use the shortcut keys F6
 Single step operation
Step 8 :

Look at the upper right corner Variables Change of

edit top fracture
This is the main area to pay attention to during commissioning , Through observation , analysis , Understand the changes in these values to enhance the understanding of the code , Or look for the error in the code
 Look at the upper right corner  Variables Change of
Red button , Click exit
 sign out


The official account of programming , Follow and get the latest tutorials and promotions in real time , thank you .


Q & A area    
2020-12-04 teacher , When I first click debug, I can do one-step debugging , Then I ran the code , hold debug The view is off , Then open , Single step debugging is black and can't be clicked , What's going on ?
1223M




teacher , When I first click debug, I can do one-step debugging , Then I ran the code , hold debug The view is off , Then open , Single step debugging is black and can't be clicked , What's going on ?
 Loading
 
               
 
               





The answer has been submitted successfully , Auditing . Please My answer Check the answer record at , thank you
answer Or code please Fill in at least one , If you have a problem , Please ask again , Otherwise, the webmaster may not see





2020-03-11 Debug The debugging perspective console does not display the currently executed content ?
XUTIEZHU




Hello teacher , I copied your code , But Debug The debugging perspective console does not display the currently executed content , Variable values are also different. What's going on
 Loading
package Practise311;
public class Deebug{
    public static void main(String[] args) {
 
        int moneyEachDay = 0;
        int day = 10;
        int sum=0;
        for (int i = 1; i <= day; i++) {
            if(0==moneyEachDay)
                moneyEachDay = 1;
            else
                moneyEachDay *= 2;
             
            sum+=moneyEachDay;
             
            System.out.println(i + "  Days later , The total amount of money in the hands of Lord Hong Gang is : " + sum );
        }
    }
 
}
 
               


4 One answer

meige
Answer time :2020-08-18
I also know that you are a fool

luodawei
Answer time :2020-06-03
Just click step by step

ProgramApe
Answer time :2020-03-29
yes

XUTIEZHU
Answer time :2020-03-11
Teacher, I know again , I'm really a fool .



The answer has been submitted successfully , Auditing . Please My answer Check the answer record at , thank you
answer Or code please Fill in at least one , If you have a problem , Please ask again , Otherwise, the webmaster may not see





2020-01-27 Can debugging leap forward
2019-09-16 I learned another trick , Thank the webmaster , Make a little progress every day
2019-07-20 idea How to debug breakpoints


Too many questions , Page rendering is too slow , To speed up rendering , Only a few questions are displayed on this page at most . also 5 Previous questions , please Click to view

Please... Before asking questions land
The question has been submitted successfully , Auditing . Please My question Check the question record at , thank you
about Tools and Middleware - Debug -Java application Debug Your questions

Try to provide Screenshot code and Abnormal information , Help to analyze and solve problems . You can also enter this station QQ Group communication : 496725845
Ask questions and try to provide complete code , Environment description , The more conducive to the recurrence of the problem , The faster your question can be answered .
Have questions about the code in the tutorial , Please provide which step , Which line is in doubt , This makes it easy to quickly locate the problem , Improve the speed at which questions are answered
In the thousands of questions that already exist , A considerable proportion , Because of the use of and webmaster Different versions of the development environment Resulting in , For example jdk, eclpise, idea, mysql,tomcat Wait, the version of the software is inconsistent .
Please use the same version as the webmaster , You can save yourself a lot of learning time . The webmaster sorted out the software versions used in teaching , It's all here , Convenient for everyone to download : /k/helloworld/helloworld-version/1718.html

Upload screenshot