Implementing object-Oriented Programming with Java (2)

Source: Internet
Author: User
Tags float double

The concept of super:

A. Super. Method names call methods of the parent class

B. Super () Represents the constructor method for calling the parent class
The object of the parent class is created by default when the subclass object is constructed, regardless of whether the super () is forced to write

Things that cannot be inherited:

1. Property or method of privatization
2. Access rights
3. Construction method (no inheritance is performed when an object is created)

The subclasses of different packages in this similar package
Private can not do not can not be
The default may not be able to not
Protected can not be able to
Public can be used to


Execution order of construction methods (with static block contents)

First, the contents of the static block of the parent class-"subclass" are executed in priority order.

The construction method executes sequentially from the parent class--The child class

Rewrite
Subclass inherits Parent Class overriding method of parent class if forced override loses reference to parent class method

Abstract classes and abstract methods

1. An abstract method is defined in the parent class so the subclass must implement this method
2. The parent class has an abstract method then the parent class must be an abstract class
3. If subclasses do not choose to implement this method subclasses must be defined as abstract classes

Judge:

Abstract class must have abstract method (F) dispensable
Classes with abstract methods must be abstract classes (T)

Final

1. Defines that the value of this property on the attribute is not allowed to change
2. The definition on the class indicates that the class is the final version cannot be inherited
3. The definition means that the method is not overridden by a quilt class
4. Defined on the construction method (meaningless direct error)

8 Basic data types:
Integer byte short int long
Float type float Double
Character Char
Boolean-Type Boolean

Implementing object-Oriented Programming with Java (2)

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.