📄 multipimpl.java
字号:
package rmicmatrix;
import java.rmi.*;
import java.rmi.server.*;
public class MultipImpl extends UnicastRemoteObject implements MultipInterface {
int a[][]=new int[20][20];
int b[][]=new int[20][20];
int c[][]=new int[20][20];
int a_row,a_col,b_row,b_col;
public MultipImpl() throws RemoteException{
super();
}
public int[][] getMultip(int a[][],int a_row,int a_col,int b[][],int b_row,int b_col) throws RemoteException {
// TODO Auto-generated method stub
this.a=a;
this.b=b;
this.a_row=a_row;
this.a_col=a_col;
this.b_row=b_row;
this.b_col=b_col;
if(a_row!=b_col)
System.out.println("矩阵1的行数不等于矩阵2的列数,无法相乘");
else
{
for(int i=0;i<a_row;i++)
for(int j=0;j<b_col;j++){
c[i][j]=0;
for(int k=0;k<a_col;k++)
c[i][j]+=a[i][k]*b[k][j];
System.out.print(c[i][j]+" ");
}
}
return c;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -