The object-oriented advanced Java review

Source: Internet
Author: User

First, the basic realization of inheritance

1. Concept and implementation of succession (extends)

2. Limitations of inheritance implementation

1) can only be single-inheritance, not multiple inheritance, but allow multiple layers of inheritance

Ii. further study of inheritance

1. Instantiation of Subclass objects (ancestor first, later self)

The constructor for a super () call to the parent class is implied in the subclass construction method

2. The concept and realization of method overwrite

1) Quilt class override method cannot have more restrictive access than the parent class method

2) A method in the parent class that is private, the method set to default in the subclass does not overwrite the parent class's method, but a new method is redefined

3) method overload (overloading) VS method overwrite (overriding)

3. super keyword Function super. Method () method of calling the parent class

This VS super

Third, Final keywords

1. Final keyword usage requirements

1) The end, the final declared class cannot be inherited, the final declared method cannot be overwritten, the final declared variable becomes a constant, the constant cannot be modified

2) Global constants: Static final

2. Declaration of Global Constants

Iv. Basic concepts of abstract classes

1. Abstract class definition Format

2. Rules for the use of abstract classes

Abstract classes cannot use the final keyword;

Abstract classes can have construction methods

Five, interface

1. Interface definition Format and use

Special classes: All global constants and common abstract methods

1) The interface must have subclasses, subclasses must overwrite all abstract methods

2) A subclass can implement multiple interfaces

3) interfaces may not inherit abstract classes, but can inherit multiple interfaces through extends

2. Relationship between interfaces and abstract classes

Vi. the polymorphism of the object

1. The object's upward transformation and downward transformation

The embodiment of polymorphism in Java: 1) overloading and overriding of methods, 2) object polymorphism (up & down Transformation)

2. Restrictions on object transformation

Seven, instanceof key words

1. The role of instanceof and the timing of its use

2. instanceof Security verification of object transformation

The downward transformation must increase the validation

A class should never inherit a class that is already implemented and can inherit only abstract classes or interfaces

VIII. abstract class and interface applications

1. Template Design

Abstract classes are used for template design, interfaces for the development of standards

2. Factory design mode

3. Proxy design mode

4. Adapter design pattern (abstract class for inheriting interfaces)

5. Differences between abstract classes and interface usage

6. Abstract classes can also contain interfaces, an interface can also contain an abstract class

Nine, Object class

1. Object class action

2. ToString () in the object class, Equals () method

3. Object class receiving operations on reference data types

Object can receive objects, receive arbitrary reference data types

Ten, packing class

1. Role of the packaging class

Integer, Character, Byte, short,long,float,double, Boolean

2. Automatic packing and automatic unpacking operation of packing class

3. Conversion operations for packaging classes

Changes the string to the specified data type

Integer.parseint ()

Float.parsefloat ()

Xi. Anonymous Inner class

1. The role of anonymous internal classes

2. Anonymous inner class definition format

The object-oriented advanced Java review

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.