201671010106 2016-2017-2 "Java Programming" learning experience 4

Source: Internet
Author: User

During The learning process in this chapter, I learned about the concept of inheritance, which is a core technology in Java programming and a mechanism for building new classes with existing classes. When a new class is defined to inherit a class, the new class inherits the method and domain of the class, adding new methods and fields to the new class to accommodate the new situation.

The main advantages of inheritance are: 1: Code reusability 2: can easily customize subclass 3: The domain and methods of the parent class are available for subclasses 4: Designing applications becomes simpler

1: By extending the superclass, you only need to point out the differences between subclasses and superclass. You can increase the domain, add methods, or override the superclass in a subclass, but you must never delete any fields and methods of the superclass.

2:super is a unique keyword that instructs the compiler to call a superclass method, which is not a reference to an object and cannot be assigned a super to another object variable. The Super keyword generally has two uses: one is to call the superclass method, and the other is to call the superclass constructor.

3: If the subclass constructor does not explicitly call the constructor of the superclass, the superclass default constructor is called automatically

There is also a sense of polymorphism: polymorphism refers to the phenomenon that the same symbol in a program has different interpretations in different situations.: 2: A domain or method defined in a superclass, after which the quilt class inherits, can have different data types or behave differently.

3: This makes the same domain or method have different semantics in the superclass and its subclasses. 4: Methods in the superclass can be overridden in subclasses.

Because of this chapter a lot of knowledge is not very thorough, so this week's blog experience can only write these, I will be good to understand that they do not understand, as soon as possible to learn to keep up with the progress of teaching

201671010106 2016-2017-2 "Java Programming" learning experience 4

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.