The most feared error in the program is the direct flash back
Programming should be done this way, to ensure that the structure is not wrong, the data can be fault-tolerant way
such as Fungetsonmfrominternet () {
Variable A
A= returning data from the network
Return a
}
In fun use it () {
Variable b=fungetsonmfrominternet ()
At this time if the previous access to network errors (very common problems), then a does not get the data, a= from the network to return Data execution errors, return a will not be executed. At this point B is null, and then using B.fun () will cause a structural error.
Therefore, we have to ensure that the structure is correct, we must return a, regardless of the data there is no, so add code block finally{
return A;
Of course a also do not put in the try statement inside the instance, otherwise will also error
}
}
Java Program fault Tolerance