Before the application can call remote methods, it must convert the remote reference's type to match the interface definition, in this case, HelloInterface. While you can do this with a simple cast, the code shown here first checks to see if the cast is valid by calling the instanceof operator. This technique lets you avoid an InvalidCast runtime exception if the type of the remote object isn't what you expect.
Once we have successfully casted the reference, we can then call remote methods; here the "getDate" method which returns a string.