201671010144 2016-2017 "Java Programming" I understand the inheritance!

Source: Internet
Author: User

The first is my understanding of the concept of inheritance, the so-called inheritance is on the basis of existing classes to create a new subclass, the inherited class is called the superclass or the parent class. Subclasses have some properties, the first subclass inherits the parent class's domain and method, so-called inheritance can call the method in the parent class through the subclass, and the second subclass can overwrite the method (override) of the parent class as needed; Thirdly, when we call a method in a superclass in a subclass, we cannot invoke the keyword (supper) directly;

In inheritance this chapter is polymorphic in one important point of knowledge, and an object variable can indicate a variety of actual types of phenomena called polymorphism. A superclass can reference an object of any subclass, but it cannot assign a reference to a superclass to a subclass object.

One more difficult thing to understand here is a code for a generic array list:

Arraylist<employee> staff=new arraylist<employee>;

annotating This code is /* declares and constructs a list of generic arrays that hold employee objects;

The greatest advantage of a generic array list is the ability to store information dynamically, saving memory space.

201671010144 2016-2017 "Java Programming" I understand the inheritance!

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.