Java print array的問題

public class xx { public static void main(String[] args) { String[][] list={{"(1)","新國民便當","50"},{"(2)","果菜汁","15"},{"(3)","麵包包","20"},{"(4)","多力多滋","20"}}; ... 顯示更多 public class xx
{
public static void main(String[] args)
{
String[][] list={{"(1)","新國民便當","50"},{"(2)","果菜汁","15"},{"(3)","麵包包","20"},{"(4)","多力多滋","20"}};

System.out.println("");
for(int i=0;i<4;i++)
{
for(int j=0;j<3;j++)
{
System.out.print(list[i][j]+"\\t");
}

System.out.println("");
}

int n=0;
String[] buy=new String[100];
int[] money=new int[100];

for(int k=0;;)
{
System.out.print("\\n輸入您想購買的東西代號:");
int choice=ConsoleIn.readLineInt();

buy[k]=list[choice-1][1];

System.out.print("\\n您需要幾個:");
int number=ConsoleIn.readLineInt();

int price=Integer.parseInt(list[choice-1][2]);

money[k]=price*number;

System.out.println("\\n這樣是"+money[k]+"元");

System.out.print("\\n還需要其他? [Y]/[N]:");
String decide1=ConsoleIn.readLine();

if(decide1.equalsIgnoreCase("Y"))
{
}

else
{
break;
}

n++;
}


System.out.println("\\n你已經買了:");
for(int k=0;k<n;k++)
{
System.out.print("\\n"+buy[k]);
}

int total=0;
for(int k=0;k<n;k++)
{
total+=money[k];
}
System.out.print("\\n總共是:"+total);
}
}

請問各位

為什麼最後print出來的...都只是buy[n-1].money[n-1]

而不是整個Array呢?

麻煩各位幫我修改一下...指點迷津

謝謝!!
1 個解答 1