Object-oriented methods ---

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/qq_44779847/article/details/102732485

0. signature method: method name parameter list +
Overload 1. Method (overload):
. 1) occur in the same class, the same method name, a list of the different parameters, a different method body
2) the compiler at compile time based on the method of signature method of automatically bound calls
2. construction methods:
1) to the member variable initial value
2) and the class of the same name, there is no return type
3) is called automatically when you create a (new) target
4) If they do not write constructor, the compiler defaults a no-argument constructor
if a constructor to write, is no longer provided by default
5) constructor can be overloaded
3.this: refer to the current object, which object calls the method refers to which object
can only be used in the method, there is a default before this method to access member variables.
this usage:
. 1) ------------- access this member variable name member variables
2) this method. name () method call --------------- (generally not)
3) the this () --------------------- - call the constructor
4.null: empty, not point to any object
if the reference value is null, this reference can not carry out any operation, and
abnormal if the operation occurs NullPointerException null pointer
references class 5 Variable draw parallels:
1) point to the same object
to another data modification affects access to the data referenced by a reference 2)
EG: house key
basic types of variable draw parallels:
1) Assignment
2) modification of one variable does not affect another variable access
eg: copy of ID card

Guess you like

Origin blog.csdn.net/qq_44779847/article/details/102732485