Java series Learning (6)-array and java series learning Array

Source: Internet
Author: User

Java series Learning (6)-array and java series learning Array

1. Method:

(1) Definition:

   

Code that completes a specific functional block, also called a function in some languages

(2) format:

   

(3) method Overloading

[In the same class, the method name is the same, the parameter list is different, and it is irrelevant to the return value]

   

2. Array

(1) Definition

   

Containers that store multiple elements of the same data type

(2) features:

   

Each element has a number starting from 0. The maximum number is: array length-1;

The professional name of the number: Index

(3) format:

   

A: Data Type [] array name (recommended)

B: data type array name []

(4) array initialization:

   

A: Dynamic Initialization

[Only the length and coefficient are given with the default value]

B: static Initialization

[Given value, the system determines the length]

C: it cannot be performed dynamically or statically at the same time. An error is reported.

(5) Java Memory Allocation

   

A: Stack, storage value type, or reference address. Data disappears after use.

B: Heap. It stores all new objects.

[Every variable in the heap has a default value

Byte, short, int, long: 0

Float, double: 0.0

Char: '\ u0000'

Boolean: false

Reference Type: null]

C: Method Area, storing local variables in brackets

D: local method area, related to the system

E: registers, CPU usage

(6) Common Operations on Arrays

   

A: array Traversal

B: obtain the maximum/small value from the array.

C: array element reverse order

D: array lookup Method

E: array sorting and Binary Search

3. Two-dimensional array

(1) Definition:

   

The element is an array of one-dimensional arrays.

(2) format:

   

(3) case:

   

A: traversal of two-dimensional arrays

B: summation of two-dimensional arrays

C: Yang Hui triangle

(4) schematic diagram

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.