Implementing object-Oriented Programming with Java (3)

Source: Internet
Author: User

breakpoints when debugging
1. The program executes one line at a
2. Important variables

Basic Data type conversions:
Double---> int

int--->double

Conversions of reference data types:

1. Upward transformation

Parent class Variable name = new Subclass instance ();

A. The line code can perform successfully without casting
B. Creating a parent class object is exactly a subclass instance
C. The method that is called when the method executes is the overridden method of the subclass (! The subclass is exactly overriding the method)
D. Unique methods that cannot invoke subclasses

2. Downward transition
Parent class-Parent class variable name = new Subclass instance ();
Subclass sub-class variable name = (subclass) The parent class variable name; = = Subclass Sub-class variable name = new Subclass Instance ()

Constant (cannot be modified for this value)
Variable names for canonical constant values all uppercase

Multi-line annotations typically hit on constant values and methods
But notice that get set doesn't need to be hit.

Parent class instantiates a subclass object
The method that is executed at the time of invocation is the overriding method of the subclass
Cannot invoke the unique method of a subclass

Implementing object-Oriented Programming with Java (3)

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.