The This of the Java object uses the recursion of the parameter passing attribute method in the Java method

Source: Internet
Author: User

One. The This keyword, the scenario used, and how to use it.

1. Conditions of Use

This is used in a method body in a class--initializes the object

Class is used in the constructor of this--reference, the object that invokes the method

2. Do not write this, call

As long as the method or constructor does not have a member variable with the same name as the local variable, you can simply not write this

Otherwise, a local variable is used in the method or in the constructor

3.static

A static method cannot call this and cannot invoke any member variable or method that is not static decorated

Two. Parameter passing properties in Java methods

1. Basic data Type--is actually a new variable, and is assigned a value but what the code does the original parameter is changed

2. Reference data Type--is actually a new variable, and points the memory address to the actual parameter as the memory changes, the original parameters will change

Three. Method recursion, need to pay attention to the static problem, as well as the dead loop problem, not much introduction

Four. Overloading of methods

Actually refers to the modifier return value method name the same parameter different n method called overload

Hint: parameter string ... A is actually equivalent to string [] A;

The This of the Java object uses the recursion of the parameter passing attribute method in the Java method

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.