import java.util.*;
public class S1 {
public static void main(String[] args) {
String twoDm[][]= new String[3][3];
int i,j;
int[] c=new int[2];
//int []d =new int[1];
Scanner sc=new Scanner(System.in);
for(i=0;i<3;i++){
for(j=0;j<3;j++){
twoDm[i][j]=sc.next();
String x= twoDm[i][j];
if(x=="aa"){
c[0]=i;//values here are not getting into array c//
c[1]=j;
}
for(int f:c){
System.out.println(f);
}
}
陣列℃,同時印刷00示出了爲什麼是什麼可以是問題陣列並不在環路
你想在這裏做什麼?這段代碼試圖解決什麼問題? – 2013-03-06 05:33:31
我想獲得數組的索引,例如,如果我提供「e」,所以我和j是e的索引...試圖獲得該索引 – Sandepp1 2013-03-06 05:37:10