XForum coding specification specification: Must perform NULL verification for the input parameters is a method in the validation, check whether the object is NULL:
Public Static Void ValidateNotnull (Final Object TestObject)
{
// if Object is Null, Then Exception is Thrown
IF (TestObject == NULL)
{
Throw New IllegalargumentException ("Object Can't Be Null.");
}
}
If it is transformed into the following form, the output will make the output more obvious: public static void validatenotnull (String ObjectName, Object Object) {if (object == null) {throw new illegalargumentException (Objectname "can't Be Null !!! ");}}
For example, in a real program: public void checklogon (string username, string password {validation.validatenotnull ("username", username; validation.validatenotnull ("password", password); // ...}
Later, in the process of running, the program will output if the username is null: java.lang.illegalargumentException: username can't be null !!!
Haha, no longer have to get null. Develop good habits, prevent mistakes, saving future time.