Java exception concepts

来源:互联网 发布:网络连接错误代码105 编辑:程序博客网 时间:2024/04/29 17:12

Java has created a number of jargon.  Here are some exception related slang:


1. Higher context.  To understand this jargon, imagine function callings like digging holes, the function call that is inside another function call is buried deeply.  So for a given function context, the higher context is any function context that is upper than the given one.

2. Exception specification.  This is the Java syntax to notify client programmer which exception will be thrown from that function.  It appears after that arguments list of the definition of the function.

3. RuntimeException.  This base class is used by Java to handle errors that cannot be found by compiler, such as null reference, array index out of bounds, et al.  Java functions don't need to throw this kind of exceptions nor catch them.  Except this kind of exception, all functions that may throw a exception must choose to 1), handle it; 2), write exception specification.  In the latter case, the client programmer should do the same thing.


原创粉丝点击