First, why is there no exception in the framework of the general subclass of the rollback configuration, when the exception occurs, the transaction has been rolled back, a good deal will only runtimeexception (unchecked non-inspected exception)
1. Throws appears in the method function head, can be used alone, and throw appears in the function body, can not be used alone, throw or try-catch-finally statement supporting use, or with throws matching use.2.throws is basically declaring that
In Java's exception class system, error and runtimeexception are non-check exceptions, others are check-type exceptions.All methods can throw runtimeexception and its subclasses without declaring throwsNon-runtimeexception can not be thrown without
The first example in this chapter is: if (t = = null) throw new NullPointerException (); It would seem pretty scary to have to check for NULL in every handle that passes into a method (because it is not known whether the caller has passed a valid
In java's exception class system, Error and RuntimeException are non-checked exceptions, while others are checked exceptions ).Non-checktype exception, that is, in the program, you do not need to try .. catch .. check type exception, you must use
7.3 Exception class and RuntimeException classThe relation and difference between exception class and RuntimeException class???Example: A string becomes an integral typeClass:runtimeexceptiondemo01 Package Limethrowable._7_3; Public class
Common RuntimeException and runtimeexceptionJava Exception (runtimeException) is a common Exception that may be asked during the interview. It is a basic requirement. More .... Pay attention to the following common types of errors:
Directory
First, the Run-time anomaly
1, what is Runtimeexceptioin
2, the characteristics of the Run-time anomaly
3, how to use the Run-time anomaly
two, run-time anomaly and ckecked difference
1, mechanism
2,
The Java exception handling mechanism relies mainly on try,catch,finally,throw,throws five keywords. The try keyword is immediately followed by a block of code enclosed in curly braces, called the try block. Similarly: The following is also known
Errors are thrown by virtual machines, such as Oom, internal errors in the system, and resource depletion. In this case, programmers do not have to give up or give up ..
Exception, which is the parent class of all exceptions. Here I will divide it:
Exceptions in Java
Exception exception we can deal with, can be remedied, encountered an exception will not be executed?
Package cn.seven.shengsiyuan.exception;/* * time:2015 April 05 12:24:58, Ching Ming Festival * location:501 *
Java exceptions are divided into two main categories: checked exceptions and runtime exceptions (runtime Exceptions). All RuntimeException classes and their subclass instances are called runtime exceptions, and exception instances that are not
The definition of runtimeexception in the Java document is: RuntimeexceptionIs the superclass that may throw exceptions during the normal operation of the Java Virtual Machine.
Thrown but not captured during method
If this exception is thrown in the function content, the function does not need to be declared, the caller does not need to handle it, and the compilation is the same (of course, it can also be declared and processed ). You do not need to declare
Java basic questions: What are the similarities and differences between runtime exceptions and general exceptions? What is the difference between error and exception? Please write the five most common runtimeexception ?,
ThrowableIt is the parent
Transferred from HTTP://BLOG.CSDN.NET/QQ635785620/ARTICLE/DETAILS/7781026 General interview in Java Exception (runtimeexception There are four or five types of common exceptions that must be asked, which are the basic requirements. More .... It is
RuntimeException more special If the exception is thrown in the function body, the function name can not be declared, and compilation can be done by the caller without processing even if the exception is declared on the function name.The reason is
General interview Java Exception (runtimeexception) is a question that must be askedcommon exceptions are listed in four or five types, which are the basic requirements. More .... Need to be aware of accumulatedsome of the following are
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.