Skip to content

Commit a929544

Browse files
author
crazy
committed
Signed-off-by: crazy <[email protected]>
1 parent 0664e41 commit a929544

5 files changed

Lines changed: 66 additions & 0 deletions

File tree

JavaBase/.classpath

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" path="src"/>
4+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
5+
<classpathentry kind="output" path="bin"/>
6+
</classpath>

JavaBase/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/bin/

JavaBase/.project

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>JavaBase</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
</buildSpec>
14+
<natures>
15+
<nature>org.eclipse.jdt.core.javanature</nature>
16+
</natures>
17+
</projectDescription>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
4+
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5+
org.eclipse.jdt.core.compiler.compliance=1.8
6+
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7+
org.eclipse.jdt.core.compiler.debug.localVariable=generate
8+
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9+
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10+
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
11+
org.eclipse.jdt.core.compiler.source=1.8
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package com.xinan.array;
2+
3+
/**本程序是测试数组相关知识
4+
* @author crazyxia
5+
*
6+
*/
7+
public class TestArray01 {
8+
9+
public static void main(String[] args){
10+
11+
/*
12+
* 数组有两种定义形式
13+
* eg:
14+
* int[] scores=new int[5];
15+
* int[] scores={45,48,97,89};
16+
*/
17+
String[] scores={"oracle","java","web"};//数组的第一种写法,其错误写法:String[] scores=new String{"oracle","java"};
18+
//正确写法:String[] scores=new String[] {"oracle","java","web"}
19+
int[] ages=new int[5];//数组的第二种数组写法
20+
ages[0]=5;
21+
ages[1]=7;
22+
ages[2]=9;
23+
//数组的遍历
24+
for(int i=0;i<=2;i++){
25+
System.out.println(ages[i]);//使用for循环遍历数组中元素
26+
}
27+
28+
System.out.println(scores[2]);
29+
System.out.println(ages[2]);
30+
}
31+
}

0 commit comments

Comments
 (0)