Java Fundamentals-Basic syntax Note

Source: Internet
Author: User

1.case without break will have penetration effect, according to Ali specification, is strictly forbidden to omit the default statement, even if it does not have a word

2.for Loop Execution order :

for (initialization 1; condition 2; iterative operation 3) {

Circulation Body 4;

}

1->2->4->3->2->4->3 ...

3. Arrays of several small dots

Arrays are supported in the form of int a[][] or even int []a[], but based on readability, it is strictly forbidden to use the form outside of int[][] a

 Also, you cannot specify the length of an array declaration in Java, only after new (inverse: int a[5])

An irregular two-dimensional array (the specified row does not specify a column), each element is a one-dimensional array, and the length is self-defined.

Also, Java implements a true array (interpreted from Baidu)

 True array:

    1. Continuously allocated in memory.

    2. The memory space in the array is private and avoids the problem of overwriting the data.

    3. The type stored in the array is deterministic, the only

Java to the next bidding clubs check (out of bounds will produce an exception, resulting in overwriting the data, so there is: Java implemented a true array, to avoid the data overwrite)

4. Modifier permission Range (4 3 2 1 decrement)

This kind of package (including sub-category) different Bun class outside

Public 1 1 1 1

Protected 1 1 1 0

Default 1 1 0 0

Private 1 0 0 0

1 of which are accessible, 0 are not accessible

5, i++ and ++i Java uses the intermediate cache variable mechanism:
i=i++ the same as:
temp=i (I on the right side of the equals sign)
i=i+1; (I on the right side of the equals sign)
i=temp; (I on the left of the equals sign)
and I=++i is equivalent to:
i=i+1;
temp=i;
i=temp;
understand the i=i++;i=++i;

Java Fundamentals-Basic syntax Note

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.