Basic Java language knowledge

Source: Internet
Author: User

1. Each element of a string array is a reference to a string that is an object, not a string stored directly inside the array, but rather a reference to it.

2. The length of the two-bit array is its number of rows, and the length of each row is the number of its rows, because in the process of storing a two-bit array, the two-dimensional array name stored in the stack, a multi-dimensional array is stored in the heap (two-dimensional arrays consist of one-dimensional arrays), and each one-dimensional A reference to each one-dimensional array is stored in a one-dimensional array, and the address of the one-dimensional array that stores the reference is stored in the two-bit array name within the stack;

One-dimensional arrays

Two-dimensional arrays

3. Simple If-else statement, you can use the three-bit operator directly? : to replace;

4. Enhanced for loop, used to traverse an array or collection object

Syntax format for (type name: Array or collection type Object) {Loop body}

5.break statement, can jump out of the loop, jump out of the current code block

6.continue statement, can only be used for loop structure, labeled continue statement can make the process of the program directly into the cycle level marked by the label

7. Basic Data type:

Integer type byte 1bit

Short 2bit

int 4bit

Long 8bit

Float type float 4bit

Double 8bit

Character type char 2bit

Boolean Type Boolean 1bit

Reference type---Object

8. One way to output an array

System.out.println (Arrays.tostring (a));

A method of the arrays class

9.

  

Virtual machine stack: Small capacity but fast, defined basic data types are stored in the virtual machine stack

10. Declaration of constants

final int a=10;

Constants can only be assigned once, and final is used when defining them;

Basic Java language knowledge

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.