Interesting to say Java processing exception

zhaozj2021-02-16  55

Way to call Java is like you call a person to do things, for example, you let him buy something.

That person will warn you, buy things, but there will be problems,

For example, if you give money, there is no thing you have to buy, these may come out behind throws,

Although these may not happen, you should have preparations for these situations.

If you can be the Lord, you have to pay for these Exception, then process;

If you can't handle these questions, then you are also throw,

Who let you find someone to buy, you will give him to deal with (for example, your boss).

There are a few bad habits after catchment here:

One is encountering Exception does not process, people tell you that money is not enough, you don't take a huge family,

But when you use something that you bought, I suddenly discovered that I didn't buy it, I can't get it.

The second bad habit is Catch (Exception),

Since Exception is all the unusual parent class, that is, all exceptions are captured here, then the same processing

This is like any problem, if you tell you what is wrong, you just have to hear two words,

Just add money, this is definitely wrong, if the problem is that there is no thing you want to buy, you can't add money.

There is also a large block of TRY ... catch is not good.

Just like you first let the person buy something, then let him cook, then feed you to eat (think of me MM, I like me MM)

Then one of these three things out of the question, you don't ask which one will give a solution directly, it is definitely unreasonable.

转载请注明原文地址:https://www.9cbs.com/read-25519.html

New Post(0)