public class miljuzhen/*求随机生成两个距阵的乘积,乘积用另外距阵一个表示出来*/
{
public static void main(String args[])
{
int Array1[][],Array2[][],Array3[][];
Array1=creatintArray(3,4);
System.out.println("距阵1为:");
printintArray(Array1);
Array2=creatintArray(4,3);
System.out.println("距阵2为:");
printintArray(Array2);
mulArray(Array1,Array2);
System.out.println("距阵3为:");
printintArray(Array3);
}
static int[][] creatintArray(int m,int n)
{
int intArray[][]=new int [m][n];
for(int i=0;i<intArray.length;i++)
for(int j=0;j<i;j++)
{
intArray[i][j]=(int)(100*Math.random());
}
}
public static printintArray(int intArray[][])
{
for(int i=0;i<intArray.length;i++)
for(int j=0;j<i;j++)
{
System.out.println("\t"+intArray[i][j]);
if ((i+1)%intArray.length==0)
System.out.println();
}
System.out.println();
}
public static mulArray(int intArray1[][],int intArray2[][])
{
int intArray3[][]=new int[][];
for(int i=0;i<intArray.length;++i)
for(int j=0;j<intArray.length;++j)
{
intArray3[i][j]=0;
for(int k=0;k<intAyyar.length;++k)
intArray3[i][j]+=intArray1[i][k]*intArray2[k][j];
}
}
}
编译错误如下:
F:\学习练习\java exersice\java files\muljuzhen.java:25: invalid method declaration; return type required
public static printintArray(int intArray[][])
^
F:\学习练习\java exersice\java files\muljuzhen.java:36: invalid method declaration; return type required
public static mulArray(int intArray1[][],int intArray2[][])
^
F:\学习练习\java exersice\java files\muljuzhen.java:38: array dimension missing
int intArray3[][]=new int[][];
大家帮忙看看哦!!!!!