Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java RMI

 
ritesh thakur
Greenhorn
Posts: 13
Android C++ Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
ritesh thakur
Greenhorn
Posts: 13
Android C++ Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so, because the class I am extending is throwing and exception, I have to declare a constructor ?
Regards
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In this case, yes.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic