On Java exceptions

Source: Internet
Author: User

In this section, briefly talk about exceptions in Java

An anomaly architecture diagram

(From: http://zhidao.baidu.com/link?url=Hvad_t9sT-wsvFHZgM3dSw1CIIPcwMfz-8japqHsAc_ Nij9mmfzjycondyelwrq-g8abcqxvbkwu0wanupsun_)

Two Exception

By visible exception There are two main subclasses runtimeexception (also called checkedexception) and Checkedexception

RuntimeException: (also called checkedexception) is a run-time exception, also known as a non-inspected exception, the programmer does not need to capture at compile time, the runtime will not occur in the exception,

Checkedexception: checked exception, i.e. manual Try catch must be made at compile time

Three, a brief analysis of the common anomalies of two kinds of anomalies

A Common RuntimeException

NullPointerException-NULL pointer reference exception

ClassCastException-type cast exception.

IllegalArgumentException-Pass an illegal parameter exception.

ArithmeticException-Arithmetic Operation exception

Arraystoreexception-Storing an incompatible object exception with the declaration type in the array

Indexoutofboundsexception-Subscript out-of-bounds exception

Negativearraysizeexception-Create an array error exception with a negative size

NumberFormatException-Numeric Format exception

SecurityException-Security exception

Unsupportedoperationexception-Unsupported Operation exception

Concurrentmodificationexception-Concurrency modification exception, which occurs when a collection is traversed with remove or modify

B Common Checkedexception

ClassNotFoundException: Class not found exception

clonenotsupportedexcepti< Span style= "color: #323e32; Font-family:verdana, song body, Sans-serif; line-height:18px; " >on: Cloning is not supported, generally occurs for implementing the Cloneable interface

dataformatexception: Data format conversion exception

illegalaccessexception: Security privilege exception, in general, is due to the
that is caused by the private method invoked by Java during reflection

interruptedexception: Thread Break exception

Ioexception:io Stream Exception。 This problem usually occurs when you read and write data.

&NBSP;

sqlexception: manipulating database exceptions

TimeoutException: Timeout exception

filenotfountexception: File not found exception

On Java exceptions

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.