[Summary] 2016.12.1 Thursday

Source: Internet
Author: User

Methods of the class
Signature of method: includes access modifier, return type, method name, parameter list, return value data type
The currently learned access modifiers include: Public private protected (protected)

To pass the parameter:
1. When an argument is passed to a parameter, the data of the actual argument is copied to the formal parameter
2. Regardless of the type of actual arguments passed, the relevant formal parameters should be a copy of the data, which is the principle of value-based transfer
In 3.JAVA only a value is passed

Overload:
Method overloading when a class has two or more methods with the same name but has a different argument list
Note: Method overloads three points: different types, different quantities, different order, but not related to formal parameter names.

Constructor:
Syntax: Person someOne = new Penson ();
In-memory space can be divided into heaps, stacks, data segments, code snippets.
Advanced back-out call method structure called stack
* FIFO call method structure called Queue *

Space Division:
1. Local variables are in the stack
2. All new objects are in the heap
3. String constants are in the data segment

about the use of this:
This. refers to the properties and methods of the current object
this () refers to a constructor method that calls another constructor of this class, which is used to construct the method reuse
Note: 1. Can only be written in the construction method   2. You can only call the constructor method of this class 3. Must be written on the first line of the construction method
If the declaration of a constructor is not displayed when defining a class, the Java compiler assigns the Class A default constructor.
public classs name{
}
     public car () {
}

1. Constructor does not have any return type
2. Constructor Reload:
The constructor has a different number of arguments or if the constructor has the same number of arguments, the parameter types are different.

[summary] 2016.12.1 Thursday

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.