private?int[][]?Details(int?imput){
????int[][]?details=new?int[imput][2];//存放租車(chē)序號(hào)和天數(shù)
????????for(int?i=1;i<=imput;i++){
????????????System.out.println("**************************");
????????????System.out.print("請(qǐng)輸入第"+i+"輛汽車(chē)的序號(hào):");
????????????Scanner?sc=new?Scanner(System.in);
????????????int?x=sc.nextInt();//租車(chē)序號(hào)
????????????details[i-1][0]=x;
????????????System.out.print("請(qǐng)輸入要租的天數(shù):");
????????????int?y=sc.nextInt();//租車(chē)天數(shù)
????????????details[i-1][1]=y;
????????????}
???????return?details;
???????}這個(gè)方法里面定義一個(gè)數(shù)組并且返回,在main中怎么使用這個(gè)數(shù)組?
添加回答
舉報(bào)
0/150
提交
取消