命令行參數(shù)示例(實(shí)驗(yàn)):
public class Test {
public static void main(String[] args){
if(args.length==0){
System.out.println("you don't set command line parameters!");
}else{
for (int i=0; i<args.length; i++){
System.out.println("args[" + i + "] is: " + args[i]);
}
}
}
}
when use eclipse, don't "run as application",directly use "run configurations/run", then add in aguments in program arguments.(當(dāng)運(yùn)行eclipse,不要"run as application",而直接用"run configurations/run",然后加上參數(shù)在,program arguments.)
result is:
args[0] is: 馬克-to-win
args[1] is: 的
args[2] is: 書
下圖是有關(guān)非eclipse命令行的實(shí)驗(yàn):
8.3 Arrays of Arrays(1)
馬克- to-win:馬克 java社區(qū):防盜版實(shí)名手機(jī)尾號: 73203。
An array that contains other arrays as its elements.(一個數(shù)組中包含其他的數(shù)組作為它的元素)
public class TwoDimentional {
public static void main(String[] args) {
char[][] table= new char[2][4];
char[] row0 = {'A','B','Z','M'};
char[] row1 = {'C','D','K','L'};
table[0] = row0;
table[1] = row1;
for(int i=0; i<2;i++){
for(int j=0;j<4;j++){
System.out.println(table[i][j]);
}
}
}
}
result is:
A
B
Z
M
C
D
K
L