Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to solve the problem of Java reporting error

Shulou Source: shulou.com Published: 2022-06-01 04:25:30 09月26日 Update

This article mainly explains how to solve the problem of reporting errors in Java. The content of the explanation in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn how to solve the problem of reporting errors in Java.

1. Operator priority is not clear, should be parenthesized without parentheses-the solution (write a short paragraph to debug, and use the breakpoint function to find out the problem. )

two。 It is best to make some conditional judgments to prevent null pointer exceptions.

3. The related toolkit was not imported. (manual import)

4. Pay attention to the scope of the variable (put it on the outside), statement block 1 cannot get the variable value of statement block 2

5. No parameters are passed

6. {} is in the wrong position.

7.

Public static void main (String [] args)

Note the difference between the two, which causes the entire class to fail to run

Public void main (String [] args)

8. The code is misplaced and written outside the main method

9. The package name is misspelled, for example, it was originally mapper.xml, but it was written as maper.xml.

10. There may be something wrong with the top guide package (don't get it wrong), and start the whole body (the corresponding configuration file is also likely to be modified)

11. It is best to refresh frequently in maven (with buffered ba)

twelve。 The reason why there is no guide package is that the pom file is not configured.

13. Put a breakpoint before the return value to find the location of the bug

14. Remember to write parameters.

15. Note the location of the Application startup class

16. Identify the problem by setting the journal level (info/debug) in the Application class

17. Incorrect name of database table field

18. The related services have not been started yet.

19. The relevant comments (@ Controlller) are not written in the controller class

Thank you for your reading, the above is the content of "how to solve the problem of Java error". After the study of this article, I believe you have a deeper understanding of how to solve the problem of Java error, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: Question location learning content parameter location parenthesis file breakpoint method best statement configuration code priority function whole body function cause variable Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Apple Docker vpn Xiaomi