8 Java Notes

Source: Internet
Author: User

The 1 import statement simplifies programming and allows you to import a class or all of the classes under a specified package

2 The Java.lang,object class is the parent class of all classes, either its immediate parent class or its indirect parent class

3 Subclasses extend the parent class, a subclass is a special kind of parent

4 If a subclass defines an instance variable with the same name as the parent class, the case where the child class instance variable hides the parent class instance variable occurs

5 subclasses do not get the constructor of the parent class, but the constructor of the child class can call the initialization code of the parent class constructor

6 Super calls the constructor of the parent class, and this invokes the overloaded constructor in the same class.

7 when writing a Java program, a reference type variable can only invoke methods of its compile-time type, and cannot invoke the method of his run-time type

8 conversions between reference types can only be performed between two types that have an inheritance relationship

9 instanceof operator The compilation type of the preceding operand is either the same as the following class or has a parent-child inheritance relationship with the following class

Initialization block in Java class: A Java class can have more than one initialization block, the same type of initialization block between the sequence, the previously defined initialization block executes first, after the initialization block defined after the execution

11 The modifier of the initialization block can only be static, also known as a statically initialized block

Java initialization blocks are executed implicitly only when the Java object is created and executed before the constructor is executed

13 static initialization blocks are always executed first than normal initialization blocks

The Java system does not allow the re-assignment of variables that are decorated with the final type, the subclass does not allow the final method to overwrite the parent class, and the final class cannot derive subclasses

The 15 enumeration class is a class that is not free to create objects, and the object of an enumeration class is fixed when the class is defined

JDK1.5 provides automatic packing autoboxing and automatic unpacking autounboxing functions

17 Auto-Boxing: Assign a basic type of variable directly to the corresponding wrapper class variable

18 Automatic unpacking: assigns the wrapper class object directly to a corresponding basic type variable

19 only two wrapper class references are equal when they point to the same object

8 Java Notes

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.