Statische Null -Überprüfung auf die Variablen im Projekt mit Intellij oder einigen anderen IDE -Plugins

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Statische Null -Überprüfung auf die Variablen im Projekt mit Intellij oder einigen anderen IDE -Plugins

by Anonymous » 02 Apr 2025, 12:09

Code: Select all

public class RMIConnect {
public static void main(String[] args) {
try {
// String host = "host";
String host ="ip";
int port = 1999; // Default RMI registry port
Registry registry = LocateRegistry.getRegistry(host, port);
MyRemoteInterface stub = (MyRemoteInterface) registry.lookup("ServiceName");
String response = stub.someMethod();
System.out.println("Response from server: " + response);
} catch (Exception e) {
e.printStackTrace();
}
}
}
< /code>
Im obigen Code -Stück führen wir keine manuelle Nullüberprüfung < /p>
für < /p>
durchRegistry registry = LocateRegistry.getRegistry(host, port);
MyRemoteInterface stub = (MyRemoteInterface) registry.lookup("ServiceName");
Wenn ich Registry.Lookup ("Servicename") verwende; eine andere Quelle.

Top