import java.io.IOException; import java.net.InetAddress; public class HostErreichbarkeit { public static void main(String[] args) { String host = "javabeginners.de"; try { InetAddress iAdr = InetAddress.getByName(host); if (iAdr.isReachable(5000)) { System.out.println("Host '" + host + "' ist erreichbar und hat die IP: " + iAdr.getHostAddress()); } else { System.out.println("Host '" + host + "' ist nicht erreichbar"); } } catch (IOException e) { System.err .println("IOProbleme beim Testen der Erreichbarkeit von: '" + host); } } }