Arayüzün bir istisna attığı bu kodu okudum, ancak bunu uygulayan sınıf bir tane atmıyor ya da birini yakalamıyor, neden bu? Java'da yasal mı, güvenli mi?Java arayüzü bir istisna atar ancak arayüz uygulaması bir istisna alamaz?
import java.rmi.*;
public interface MyRemote extends Remote {
public String sayHello() throws RemoteException;
}
import java.rmi.*;
import java.rmi.server.*;
public class MyRemoteImpl extends UnicastRemoteObject implements MyRemote{
public String sayHello() {
return "Server says, 'Hey'";
}
public MyRemoteImpl() throws RemoteException {}
public static void main (String[] args) {
try {
MyRemote service = new MyRemoteImpl();
Naming.rebind("RemoteHello", service);
} catch(Exception ex)
{
ex.printStackTrace();
}
}
}
http://www.coderanch.com/t/399874/java/java/Methods-throwing-Exception-Interface –
adresindeki tartışmaya göz atmak isteyebilirsiniz. Evet yasal. Ve sen, CHetter'ın gönderdiği bağlantıyı görmeli ve cevap olarak da göndermeliydin .. – Thihara
Teşekkürler Thihara. Bunu yaptın. –