1. when the println () method is used for objects of the string type, if the object is null, null is printed instead of nullpointerexception, which may lead to the illusion of reference, subsequent operations on strings may cause problems.
2. nullpointerexception is thrown because the object existence is not verified. In JSP programming, if (request. getparameter ("username "). equals ("XXX"), out. println (Session. getattribute ("record. The solution to this problem is to compare the null values before use:
If (request. getparameter ("username ")! = NULL)
{If (request. getparameter ("username ").
Equals ("XXX "))...}
3. numberformatexception: The main cause is that the user inputs other illegal characters when converting the content submitted by the user to an integer or floating point number. The main method of processing is to capture this exception by using try/catch blocks where the conversion is needed, and then prompt the user to enter valid data.
4. stringindexoutofboundsexception exception: the main cause is that the string substring (), charat () and other methods are used. If the string length is insufficient, this exception is thrown; when the string is null, nullpointerexception is also thrown. The solution is to determine the length or convert it to a byte array. Many of these operations can be encapsulated into a JavaBean.
5. The noclassdeffounderror error is caused mainly because the class path or class file is placed incorrectly. The class file should be placed in line with the server's requirements.
6. raise Java. lang. error: The main cause is that the system accesses external resources and does not close the operation, resulting in a large amount of waste of external resources, which may cause the system to fail to run normally; too many times have been disabled for external resources accessed by the system, and the external system cannot be properly processed; external resources accessed by the system may experience exceptions.
The solution is: before accessing an external resource, first check whether the resource (such as a database) can be normally connected or operated. when accessing an external resource, you must disable the connection, only one close operation is performed. Try to share external resources in the same operation to reduce resource consumption and improveProgramExecution efficiency.