日期:2014-05-20  浏览次数:20615 次

不懂这个书上是程序怎么运行不出来啊

package welcome;

public static class transpose{

public static void main(String[] args)
{
int a[][]={{1,2,3},
               {4,5,6},
              {7,8,9}};

        int b[][]=new int [3][3];
          trans pose=new trans();
         b=pose.transpose(a);
    for(int i=0;i<b.length;i++)
       {
        for(int j=0;j<b[i].length;j++)
        {
         System.out.println(b[i][j]+"  ");
         System.out.print(" \n "); 
         }
   }
}
class trans
{
int temp;
int [][]transpose(int[][] array)
{
for(int i=0;i<array.length;i++)
for(int j=i+1;j<array[i].length;j++)
{
temp=array[i][j];
array[i][j]=array[j][i];
array[j][i]=temp;
}
return array;
}
}
}
class

------解决方案--------------------
引用:

为什么还是运行不了


class trans 写到 class Test外面:
public class Test{
。。。
}
class trans{
。。。
}