-
Notifications
You must be signed in to change notification settings - Fork 0
/
client.java
28 lines (27 loc) · 921 Bytes
/
client.java
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 RemoteException{
client c=new client();
c.connectRemote();
}
private void connectRemote() throws RemoteException{
try{
Scanner sc =new Scanner(System.in);
Registry reg=LocateRegistry.getRegistry("localhost",9999);
adder ad;
ad = (adder)reg.lookup("hi server");
System.out.println("Enter two number");
int a=sc.nextInt();
int b=sc.nextInt();
System.out.println("Addition is"+ad.add(a,b));
}
catch(NotBoundException|RemoteException e)
{
System.out.println("exception"+e);
}
}
}