![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is a remote interface in java?
A Remote interface is available in the java.rmi package it is a marking/tagging interface, it is used with remote method invocation(RMI).
RMI is a mechanism that allows an object residing in one system (JVM) to access/invoke an object running on another JVM.
To it is a marking interface, to mark an object of a class remote, you need to implement this interface.
To create a remote interface −
Create an interface that extends the predefined interface Remote which belongs to the package or, implement the Remote interface with the class, which you need to make remote.
Declare all the business methods that can be invoked by the client in this interface.
Since there is a chance of network issues during remote calls, an exception named RemoteException may occur; throw it.
Example
import java.rmi.Remote; import java.rmi.RemoteException; // Creating Remote class for our application public class RemoteExample implements Remote { } Or, import java.rmi.Remote; import java.rmi.RemoteException; // Creating Remote interface for our application public interface Hello extends Remote { void printMsg() throws RemoteException; }