简体   繁体   English

为什么界面在创建RMI应用程序中很重要?

[英]why interface is important in creating RMI application?

When we create RMI application in java do we have to create an interface first? 在Java中创建RMI应用程序时,是否必须先创建接口? Is an interface compulsory? 接口是强制性的吗? Can we create RMI application without creating an interface? 是否可以在不创建界面的情况下创建RMI应用程序? If not then why is the interface compulsory? 如果不是,那么为什么必须使用该界面? What is the function of it? 它的作用是什么? If anyone has code of Chatting in RMI without using remote interface then could you send that code to me? 如果有人在不使用远程接口的情况下在RMI中拥有聊天代码,那么您可以将该代码发送给我吗?

RMI is about a client machine communicating with a server machine in such a special way that it seems from the programmer's perspective that you are invoking methods of an object which resides on the server. RMI是关于客户端计算机与服务器计算机通信的一种特殊方式,从程序员的角度来看,您似乎正在调用驻留在服务器上的对象的方法。

Clearly, there is some network communicating "magic" going on behind the scenes, and the central programming paradigm which enables this separation of the "behind the scenes" action and the perception you get by reading client code is, well, interface . 显然,有一些网络通信的“神奇”走出幕后,与中央编程范式使这种分离的“幕后”操作,只需通过阅读客户端代码得到的看法是,良好的interface

From this line of reasoning you should be able to convince yourself that you not only cannot get around defining an interface , it is in fact the central concept around which everything else is built. 通过这种推理,您应该能够使自己确信,您不仅无法绕过定义interface ,而且事实上,它是构建其他所有内容的中心概念。

When we create RMI application in java do we have to create an interface first? 在Java中创建RMI应用程序时,是否必须先创建接口?

Yes. 是。

Is an interface compulsory? 接口是强制性的吗?

That's the same question, and the answer is also the same. 这是相同的问题,答案也相同。 Yes. 是。

Can we create RMI application without creating an interface? 是否可以在不创建界面的情况下创建RMI应用程序?

That's the same question for a third time, and the answer is still the same, although in the negative this time as you reversed your question. 这是第三次是相同的问题,答案仍然是相同的,尽管这次您的问题否定了。

If not then why is the interface compulsory? 如果不是,那么为什么必须使用该界面?

Because that's how they designed it. 因为那是他们设计的方式。 If you didn't have a remote interface, you wouldn't have any API to call your remote methods with at the client. 如果您没有远程接口,那么您将没有任何API可以在客户端调用您的远程方法。

What is the function of it? 它的作用是什么?

That's the same question again, and the answer is also the same. 再次是相同的问题,答案也相同。

If anyone has code of Chatting in RMI without using remote interface then could you send that code to me? 如果有人在不使用远程接口的情况下在RMI中拥有聊天代码,那么您可以将该代码发送给我吗?

That's not a proper request for this site. 这不是对该网站的适当要求。 If there is such code, which there isn't, and can't be, it should be posted here as an answer. 如果有这样的代码,没有,也不能,则应将其张贴在此处作为答案。 This is not a private help desk. 这不是私人帮助台。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM