20165221 Java Fourth Week learning experience

Source: Internet
Author: User
Summary of the contents of teaching materials sub-category and inheritance
  • Subclass and Parent class
    The standard format defined is

    class 子类名 extends 父类名 {...}
    If a keyword is not used in the declaration of a class, the extends default is the object class.
  • Inheritance of subclasses
    The criterion for judging whether or not to inherit is to see if the subclass can manipulate the member variable of the parent class , and if the child class is in the same package as the parent class , the inheritance is not private , not in the same package, and the subclass inherits only the protected and public classes.
  • Subclasses and objects
    About the instanceof operator there should be an operand to the left, the action element on the right is the class
  • Hide and method overrides for member variables
    When you write a subclass, the name of the member variable that is generated is the same as the inherited name, and the subclass hides the inherited member variable.

Test the wrong question in the third week




20165221 Java Fourth Week learning experience

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.