import java.rmi.Naming; import java.rmi.NotBoundException; import java.rmi.RemoteException; import javax.swing.JOptionPane; public class ClientOperation { private static RMIInterface look_up; public static void main(String[] args) throws RemoteException { try{ look_up = (RMIInterface) Naming.lookup("//localhost/MyServer"); String city = JOptionPane.showInputDialog("Enter the city name"); String hotel = JOptionPane.showInputDialog("Enter the hotel name"); String str = ""; String []hotelName = look_up.display(city); for (int i = 0; i < hotelName.length; i++) {//for loop to print the array str = str + " " +(hotelName[i]); System.out.print( hotelName[i]+ " "); } JOptionPane.showMessageDialog(null, str); String response2 = look_up.booking(city, hotel); JOptionPane.showMessageDialog(null, response2); } catch(Exception e){ System.err.println("Server exception: " + e.toString()); e.printStackTrace(); } } }