標題:
基礎陣列(一)
[打印本頁]
作者:
周政輝
時間:
2016-11-5 11:21
標題:
基礎陣列(一)
宣告一個 int 10的陣列
並依序給予值
int [] num = new int [10];
num[0] = 10;
num[1] = 1;
num[2] = 2;
num[3] = 3;
num[4] = 4;
num[5] = 5;
num[6] = 6;
num[7] = 7;
num[8] = 8;
num[9] = 9;
System.out.println(num[0]);
複製代碼
作者:
張健勳
時間:
2016-11-5 11:24
package site.istak.org.tw;
public class Main {
public static void main(String[] args) {
// TODO 自動產生的方法 Stub
int [] num = new int [10];
num[0] = 0;
num[1] = 1;
num[2] = 2;
num[3] = 3;
num[4] = 4;
num[5] = 5;
num[6] = 6;
num[7] = 7;
num[8] = 8;
num[9] = 9;
System.out.println(num[0]);
}
}
複製代碼
作者:
王彥甯
時間:
2016-11-5 11:25
package site.istak.org.tw;
import java.util.Random;
public class main {
public static void main(String args[]){
Random random = new Random();
int num[] = new int [10];
num[0] = 8520;
num[1] = 951;
num[2] = 753;
num[3] = 98765432;
num[4] = 12345678;
num[5] = 88888888;
num[6] = random.nextInt(100);
num[7] = 65455;
num[8] = random.nextInt();
num[9] = 10000000;
System.out.println(num[5]);
}
}
複製代碼
作者:
謝瀞儀
時間:
2016-11-5 11:25
package messing1;
public class messing01
{
public static void main(String[] args)
{
int [] num = new int [10];
num[0] = 0;
num[1] = 8;
num[2] = 5;
num[3] = 7;
num[4] = 0;
num[5] = 8;
num[6] = 9;
num[7] = 4;
num[8] = 5;
num[9] = 7;
System.out.println(num[2]);
}
}
複製代碼
作者:
蔡庭豪
時間:
2016-11-5 11:28
package site.istak.org.tw;
import java.util.Random;
import java.util.Scanner;
public class Main {
public static void main(String args[]){
int [] x = new int [10];
for(int i=0;i<10;i++){
x[i]=i;
System.out.println(x[i]);
}
}}
複製代碼
作者:
蔡季樺
時間:
2016-11-10 18:02
package site.istak.org.tw;
public class Main {
public static void main(String[] args)
{
int array[]= new int[5];
array[0] = 1;
array[1] = 2;
array[2] = 3;
array[3] = 4;
array[4] = 5;
for(int i=0;i<5;i++)
{
System.out.println(array[i]);
}
}
}
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://istak.org.tw/seed/)
Powered by Discuz! 7.2