Javaoo 11 12 15 13 Chapter

Source: Internet
Author: User

Exception handling

Exceptions (exception) are problems that occur during the execution of a program

Exception classification:

1 Checking for exceptions

2 Running exceptions

3 Error

There are three ways to handle exceptions:

1. Catch the exception so that it continues to throw down the call gate

2. Catch the exception and let it throw down

3. Do not catch exceptions

RuntimeException and subclasses are run-time exceptions, others are check exceptions

The try does not have an exception when the catch () is not executed

The other code does not perform a catch () statement block execution that jumps to the corresponding catch exception after the try exception occurs

Runtime exceptions are thrown during run time

Catch a generic exception after catching a special exception first

Packing Box Unpacking

Integer i=new integer (13)

Integer j=13 Boxing: Base type >> Reference type

Integer k=i Unpacking: Reference type >> base type

Collection Frame

Working with multiple identical data we use arrays but array space fixed cannot grow dynamically

Features: element types can be different set length variable space is not fixed

List interface: A column of data, data content can be repeated, elements placed in the order to place elements will not be rearranged

Set interface: A column of data that cannot be reused using one of its own internal permutation mechanisms to place elements

Map interface: A column of data that uses one of its own internal arrangement mechanisms to place elements

ArrayList (Array): Used most widely when collection element additions or deletions are infrequent. Best for querying

LinkedList (link): Used when you need to add or remove elements frequently in the middle of a collection

Vector: Similar to arratlist, thread-safe, so performance is less than ArrayList

LinkedList > ArrayList > Vector

Generics: Guaranteed data type Security, no re-casting of data types

Duplicate keys are not allowed in map, can be any type

Reflection class loading and garbage collection

Class loading: Completed by the ClassLoader, a class file is read into memory and a java.lang.Class is created

Once a class is loaded into the JVM, the same category will not be loaded again

Link: Merging binary data from a class into the JRE

Reflection

Java's reflection technology is one of the characteristics of Java programs that allow a running Java program to check itself and manipulate the program's internal properties directly

Garbage collection is automatically recycled

Javaoo 11 12 15 13 Chapter

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.