* Java memory Division & amp; this & amp; static & amp; return

Source: Internet
Author: User


Java syntax basics-function termination -- return

Public static int show (boolean B ){
If (B)
Return 11;
Else
Return 0;
}
--- The main function also has return


Public static void show2Int (int age ){
If (age <0)
System. out. println ("the value is invalid"); return;
System. out. println (x );

}
---------------------
Array
Array definition: a collection of the same type of data, that is, a container,
Features:
1. The data must be of the same type.
2. The number of elements must be specified during storage.
---------------


* ** Java memory Division

1. Register: The region of the cpu


2. Local Method Area: The system-related code storage area


3. stack memory: all local variables are stored, and the variable operation area is released at the end,
Local variables: parameters in the method, variables in the method, and variables in the statement


4. heap memory: It stores arrays and objects. In short, the storage in heap memory is an object.
An object is a place where multiple data can be stored. Remember, as long as the object is created with new, it is stored in the heap memory.
Features:
1. Any entity has a memory address value
2. All variables in heap memory have default initialization values.

5. Method Area: store shared data items

Memory Diagram



Diagram of object initialization process


<喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> Environment + Environment/zoaM8YnI + Environment/nU2rXEuq/K/environment/Environment + 6zbPJ1LGx5MG/zazD + Environment/i31iA8YnI + CiA8YnI + Environment/Environment + Environment/environment/ examples/examples + Cn08YnI + examples/K/bX308M8YnI + examples/W0M7Kvbb + o7q5udTsuq/K/dauvOS1xLX308O/examples + a4 + examples/K/examples + authorization + m/authorization ++ keys/K/keys + cores + CmNsYXNzIFBlcnNvbns8YnI + cores + Cn08YnI + cores + Cn08YnI + cores + 1rK/tPrC67/keys + cores + CnsvL77Wsr + 0 + sLrv + mjrL/Y1sax5MG/tcTJ + response + Cn08YnI + response/response + CnsvL7m51Oy0 + sLrv + response/nT0LbUz/O9 + NDQs/response "cons code run ");
Try ();
}
Person () {// initialize the corresponding object
......
}
Public void cry (){
Sop ("wow ");
}
}


This memory Diagram



------------
Static key? Http://www.bkjia.com/kf/yidong/wp/ "target =" _ blank "class =" keylink "> templates/zy/m5ss/toaM8YnI + templates + bXxcDgtcTP + 8 qntvjP + templates/vL + bX308M8YnI + templates /users + ssyss8nUsaOs0rK/users + users/users + rHtttTP86Ostvi + users/users + ssystcQ8YnI + users/users + ssystcQ8YnI + users/users + users + kernel + vrLMrLPJ1LGx5MG/kernel/ix8KO/kernel + kernel/PGJyPgq + kernel/kernel + bXxbbUz/O1xM/7yqe2 + M/kernel + kernel/vKp7XEz/kernel + CjMut8e + cores/ztffTwyA8YnI + Cr6yzKyx5MG/v8nS1LG7wODD + cores/cores + cores/K/cores/u8tL /samples + 7PGoaNqdm3Iz8q2uMPD + 7 PGuMPD + samples/K/bXEss7K/samples/u0rsr91 + samples/samples + Cn08YnI + region/region + region/0ru49rbUz/region/O5ss/region/uPa21M/z1tA8YnI + CiA8YnI + region/K/region + region/ release/release + 7X308O8tL/release + release/L + dLUvs3U2rG + release/LPM0PK + release + Cn08YnI + release + ssystPrC67/ pPGJyPgo8YnI + response/6Txicj4KU3lzdGVtLm91dC5wcmludGxuKA = "B ");

}
}

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.