Two Laptop Bag*
The moose likes Sockets and Internet Protocols and the fly likes Java RMI Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Java RMI" Watch "Java RMI" New topic
Author

Java RMI

ritesh thakur
Greenhorn

Joined: Jul 08, 2013
Posts: 13

below is a code to implement a simple program of addition using RMI. When i implement the interface HELLOINTERFACE.java in HELLO.java, why do i have to make a constructor hello in hello.java ?



Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41052
    
  43
Since we're talking about a no-argument constructor, normally the default constructor would suffice. But since the no-argument constructor of the class you're extending (UnicastRemoteObject) throws RemoteException, so must the one in this class - and the default constructor doesn't do that.


Ping & DNS - my free Android networking tools app
ritesh thakur
Greenhorn

Joined: Jul 08, 2013
Posts: 13

so, because the class I am extending is throwing and exception, I have to declare a constructor ?
Regards
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41052
    
  43
In this case, yes.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Java RMI
 
Similar Threads
RMI Problem : java.lang.ClassCastException
Problems with Java RMI
How to read Clients CPU information on Server
RMI in netbeans on windows
exception in client side