code, software architect, articles and novels. 代码,软件架构,博客和小说
Java手记---数组,作用域,引用
Posted onEdited onWord count in article: 2kReading time ≈2 mins.
##array
1 2 3 4 5
boolean [] a; a = newboolean [] {true,false}; System.out.println(a[0]+" "+a[1]); //this is right. System.out.println(a[0]+a[1]); //this is wrong. Because two boolean can't add . System.out.println(a[0],a[1]); //this is also wrong. Because the function can't take two paraments take two paraments.
int [] b = newint []{1,2,3,5,7}; // this is right. int [] b = newint [5]{1,2,3,5,7}; //this is wrong. ///////////////////////////////////////////////////////////////// staticint[] creat(int a)///返回一个数组。 { int[] array = newint [a]; .................................. return array; ///只写数组名。 }