Skip to content

Commit 537acad

Browse files
committed
优化“在java中声明数组”
1 parent d7c95f3 commit 537acad

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ stackoverflow-Java-top-qa
3232
* [能否在一个构造器( `constructor` )中调用另一个构造器](https://github.com/giantray/stackoverflow-java-top-qa/blob/master/contents/How-do-i-call-one-constructor-from-another-in-java.md)
3333
* [ `finally` 代码块总会被执行么](https://github.com/giantray/stackoverflow-java-top-qa/blob/master/contents/Does-finally-always-execute-in-Java.md)
3434
* [如何将String转换为enum](https://github.com/giantray/stackoverflow-java-top-qa/blob/master/contents/convert-a-string-to-an-enum-in-java.md)
35+
* [在Java中声明数组](https://github.com/giantray/stackoverflow-java-top-qa/blob/master/contents/Declare-array-in-Java.md)
3536

3637
> 编程技巧
3738
@@ -74,7 +75,6 @@ stackoverflow-Java-top-qa
7475
- [Initialization of an ArrayList in one line](http://stackoverflow.com/questions/1005073/initialization-of-an-arraylist-in-one-line)
7576
- [Java inner class and static nested class](http://stackoverflow.com/questions/70324/java-inner-class-and-static-nested-class)
7677
- ['Must Override a Superclass Method' Errors after importing a project into Eclipse](http://stackoverflow.com/questions/1678122/must-override-a-superclass-method-errors-after-importing-a-project-into-eclips)
77-
- [Declare array in Java?](http://stackoverflow.com/questions/1200621/declare-array-in-java)
7878
- [Fastest way to determine if an integer's square root is an integer](http://stackoverflow.com/questions/295579/fastest-way-to-determine-if-an-integers-square-root-is-an-integer)
7979
- [How to fix: Unsupported major.minor version 51.0 error?](http://stackoverflow.com/questions/10382929/how-to-fix-unsupported-major-minor-version-51-0-error)
8080
- [What is reflection and why is it useful?](http://stackoverflow.com/questions/37628/what-is-reflection-and-why-is-it-useful)

contents/Declare-array-in-Java.md

+9-6
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,25 @@
1-
##在java中声明数组
1+
##在java中声明数组
22

33
###问题描述:
4-
你是如何在jva中声明数组的
4+
你是如何在Java中声明数组的
55

6-
你可以进行用数组声明或者数组常量(注意:当你声明或者立即影响了变量,数组常量将不能再用来分配一个数组)
7-
对于原始类型:
6+
###回答:
7+
你可以直接用数组声明,或者通过数组的字面常量(array literal )声明
8+
9+
对于原始类型(primitive types):
810
```
911
int[] myIntArray = new int[3];
1012
int[] myIntArray = {1, 2, 3};
1113
int[] myIntArray = new int[]{1, 2, 3};
1214
```
13-
杜宇类,比如String类,也是相同的:
15+
16+
对于其他类,比如String类,也是相同的:
1417
```
1518
String[] myStringArray = new String[3];
1619
String[] myStringArray = {"a", "b","c"};
1720
String[] myStringArray = new String[]("a", "b", "c");
1821
```
19-
[stack overflow链接:Declare array in Java?](http://stackoverflow.com/questions/1200621/declare-array-in-java#)
22+
[stackoverflow链接:Declare array in Java?](http://stackoverflow.com/questions/1200621/declare-array-in-java)
2023

2124

2225

0 commit comments

Comments
 (0)