In Java, errors are classified into two types based on the error nature: errors and exceptions.
In JavaProgramIf an exception occurs during execution, an exception object is generated. The generated exception object is passed to the Java runtime
Brief introduction:1, the concept of abnormalExceptions: Problems--abnormal---are encapsulated into objects;The object that Java describes to different abnormal situation is embodied; for serious exceptions, Java is described by the error class-----
is q:throable being checked for abnormalities?A: Yes
In the Java specification, the definition of a non-checked exception and a checked exception is this:
The unchecked exception classes is the run-time exception classes and the error
The abnormally large classification is divided into detection anomaly (checked exception) and non-detectable anomaly (unchecked exception). The detection exception is the exception that can be found in the compiler.
Non-detectable anomaly also
10.3 Throwing an exception
The concept of exception throwing has been mentioned in the previous section. If the exception thrown in the try block is not able to catch its catch block, or if the exception is caught but does not want to be processed
This section describes how to use the try, catch, and finally blocks of the exception processor to compile the exception processor. The last example is to analyze what happened under different circumstances.The following example defines and
1 GuideTry... Catch... Finally is probably a familiar statement, and it seems easy to understand logically. However, the lessons I personally learned tell me that this is not as simple and obedient as I imagined. Believe it? Let's take a look at the
PrefaceThis article mainly discusses Java's violation control, including the following:1) What is violation control?2) concept of violation3) class hierarchy in Java4) how to throw and capture violations5) how to handle the violation after
Java violation control summary
This article mainly discusses Java's violation control, including the following:1) What is violation control?2) concept of violation3) class hierarchy in Java4) how to throw and capture violations5) how to handle the
First, what is an exception:Exceptions are problems that occur at run time. Usually described with Exception .In Java, an exception is encapsulated into a class , and when a problem occurs, an exception class object is created and the
Early programming languages, such as C, do not have exception handling, usually by encountering errors that return a particular value or setting a flag, and to determine whether there is an error. As the scale of the system expands, this error
Exceptions allow us to force the program to stop running and tell us what's wrong, or force the program to handle the problem and return to a stable state.Java provides a Throwable class, which is a superclass of all exceptions and error classes.
Java notes
Java SE: Java Standard Edition for table-level application and database development;
Java EE: Java Enterprise Edition for enterprise-level development;
Java me: Java handheld edition for embedded and mobile development.
Chapt 1
1) Java
Three kinds of exceptions:Check Exceptions: User error actions or problems that cannot be foreseen by the programmer must be handled by the Java language.Runtime exception: A runtime exception is an exception that can be avoided by programmers, such
Java Exception Handling and java Exception Handling
Exceptions are some errors in the program, but not all errors are exceptions, and sometimes they can be avoided.
For example, if your code is missing a semicolon, the running result indicates that
Attention:All exceptions in 1.Java are objects generated by subclasses of the Throwable class, and all exception classes are subclasses of subclasses or subclasses of the Throwable class. The Throwable class is a direct subclass of the object class,
0. Why the exception handling mechanism should be introduced.
Before the exception mechanism is introduced, the exception is handled using If...else,sysout and Syserror methods. Exception handling is a very important aspect of program design, but
The Throwable class is the parent class of the entire exception system class, and of course the parent that ends up in the end is, of course, attributed to the object class. The Throwable class implements the Serializable interface, which means that
Even though everyone wants to be healthy and to handle things smoothly,But in real life always encounter various conditions, such as cold fever, computer suddenly blue screen and so on. The same procedure, the program in the process of operation,
Exceptions The existing program development technology and testing technology cannot ensure that there are no errors in the program. Many errors do not occur during program compilation (that is, code errors ), it is generated at runtime due to
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.