java array method, parameter passing

Two-dimensional array:

The first:

int [] [] arr = new int [2] [3]; // define the length

arr [0] [0] = 1; // Assignment

The second:

int [] [] arr2 = new int [3] []; // only defines a two-dimensional array of length

arr [0] = new int [] {1,2,3,4,5} // assigned to a one-dimensional array

arr [1] = new int [3]; // to a one-dimensional array defined length

arr [1] [1] = 222; // Assignment

Third:

int [] [] arr3 = {{1,2,3}, {4,5,6}, {7,8,9}}; // Assignment

method:

1. None None Return Value defined parametric method

public static void star1(){}

2. Define the non-parametric method returns a value

main(){int star2=star2();}

public static int star2(){return star2;}

3. Define the non-parametric method return value

main () {int star3 (22,33);}

public static void star3(int aa,int bb){}

4. The parameter values ​​are defined with a return side

main () {int star4 star4 = (44,55);}

public static int star4(int cc,int dd){return star4;}

Parameter passing:

Overload: a method name can be used, but require the number, type, there is a different order.

Guess you like

Origin www.cnblogs.com/god3064371/p/11491909.html