-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathclient.java
More file actions
28 lines (24 loc) · 994 Bytes
/
client.java
File metadata and controls
28 lines (24 loc) · 994 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import java.rmi.NotBoundException;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.util.Scanner;
public class client {
public static void main(String[] args) throws NotBoundException, RemoteException {
client c = new client();
c.connection();
}
public void connection() throws RemoteException, NotBoundException {
try{
Scanner sc = new Scanner(System.in);
System.out.println("Enter two numbers to Multiply");
int num1 = sc.nextInt(), num2 = sc.nextInt();
Registry reg = LocateRegistry.getRegistry("localhost", 8000);
multiply mul = (multiply) reg.lookup("server");
System.out.println("Combination is " + mul.combination(num1, num2));
System.out.println("Result is " + mul.multiply(num1, num2));
}catch(RemoteException e){
System.out.println("Error is " + e);
}
}
}