Java Day 11

Source: Internet
Author: User

Exception Throwable
Sub-category Error, Exception

Error-cannot be processed
Exception-Targeted treatment

Principle

Throw throws for custom exception exception classes
Check for syntax errors first, and then check for logic errors

The custom exception is either captured or declared

Classification of exceptions
1, compile-time is detected exception: exception and its subclasses, except RuntimeException
2. No exception detected at compile time (runtime exception): RuntimeException and its subclasses

Throws and throw differences
1, throws use on the function
Throw is used in the function.
2, throws thrown is an exception class, you can throw multiple, separated by commas
Throw throws an exception object

Exception capture Try Catch
try{//code that needs to be detected exception}
catch (Exception class variable) {
Code to handle exceptions
}
finally{//is bound to be executed code}

E.printstacktrace ();

Object class--equals method
Native Local methods

Hashcode method
Integer.tohexstring ();

GetClass method
Byte-code file object
. getName

ToString Method
GetClass (). GetName () + "@" + hashcode ()


Java Day 11

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.