Skip to content

Commit a783ae6

Browse files
author
astrotycoon
committed
update
1 parent 56fcda2 commit a783ae6

2 files changed

Lines changed: 36 additions & 0 deletions

File tree

array/Arr.class

2.12 KB
Binary file not shown.

array/Arr.java

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
public class Arr {
2+
public static void main(String args[]) {
3+
int a[] = {1, 2, 3, 4};
4+
int b[] = {100, 200, 300};
5+
int c[] = {7, 8, 9};
6+
char d[] = {'A', '你', '好', '啊', '!'};
7+
8+
System.out.println("数组a的元素个数 = "+ a.length);
9+
System.out.println("数组b的元素个数 = "+ b.length);
10+
System.out.println("数组c的元素个数 = "+ c.length);
11+
12+
System.out.println("数组a的引用 = "+ a);
13+
System.out.println("数组b的引用 = "+ b);
14+
System.out.println("数组cde引用 = "+ c);
15+
16+
System.out.println("a == b的结果是"+ (a == b));
17+
a = b;
18+
System.out.println("数组a的元素个数 = "+ a.length);
19+
System.out.println("数组b的元素个数 = "+ b.length);
20+
21+
System.out.println("a == b的结果是"+ (a == b));
22+
System.out.println("a[0] ="+ a[0] + ",a[1] ="+ a[1]+ ",a[2] ="+ a[2]);
23+
System.out.println("b[0] ="+ b[0] + ",b[1] ="+ b[1] +",b[2] ="+ b[2]);
24+
25+
System.out.println("b == c的结果是"+ (b == c));
26+
b = c;
27+
System.out.println("数组b的元素个数 = "+ b.length);
28+
System.out.println("数组c的元素个数 = "+ c.length);
29+
System.out.println("b[0] = "+ b[0] +",b[1] = "+ b[1] +",b[2] = "+ b[2]);
30+
System.out.println("c[0] = "+ c[0] +",c[1] = "+ c[1] +",c[2] = "+ c[2]);
31+
32+
System.out.println(d);
33+
System.out.println("数组d的引用"+a);
34+
System.out.println("数组d的元素个数 = "+ d.length);
35+
}
36+
}

0 commit comments

Comments
 (0)