为什么这个矩阵乘法不能运行?
源代码如下 :
improt java.io.*;
public class MultiMatrix {
int[][] multiplyMatrix;
public static void main(String args[]){
int[][] a={{1,0,3,-1},{2,1,0,2}};
int[][] b={{4,1,0},{-1,1,3},{2,0,1},{1,3,4}};
MultiMatrix mm=new MultiMatrix();
mm.mMatrix(a,b);
mm.display();
}
public void mMatrix(int[][] a,int[][] b){
multiplyMatrix=new int[a.length][b[0].length];
for (int i = 0; i <a.length; i++) {//rows of a
for (int j = 0; j <b[0].length; j++) {//columns of b
for (int k = 0; k <a[0].length; k++) {//columns of a = rows of b
multiplyMatrix[i][j]=multiplyMatrix[i][j]+a[i][k]*b[k][j];
}
}
}
}
public void display(){
for (int i = 0; i <multiplyMatrix.length; i++) {
for (int j = 0; j <multiplyMatrix[0].length; j++) {
System.out.print (multiplyMatrix[i][j]+ " ");
}
System.out.println ( " ");
}
}
}
出错信息是Exception in thread "main() " java.lang.NoClassDefFoundEerror:MultiMatrix.java
请教高手帮我解决下,急用?
------解决方案--------------------Are you trying to execute your program like this?
java MultiMatrix.java
This is wrong. Use the main class name as the argument of java command.
java MultiMatrix
------解决方案--------------------同 z_lping(Schemer) 能编译,能运行
你用什么环境的?
-----------------------------------
http://ma3310.vicp.net
------解决方案--------------------把类名MultiMatrix改成MultiMatrixy就可以了,试试看