📄 factorialimpl.java
字号:
/////// FactorialImpl.java ///////
package myrmi.demo;
import java.rmi.*;
import java.rmi.activation.*;
public class FactorialImpl extends Activatable
implements Factorial
{
public FactorialImpl(ActivationID id, MarshalledObject data)
throws RemoteException
{
super(id, 0);
}
public int factorial(int n)
throws RemoteException
{
if ( n < 0 )
throw( new RemoteException(
"Arg to factorial cannot be negative."));
return ( n == 0 ) ? 1
: n*factorial(n-1);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -