try {
InetAddress macfaq = InetAddress.getByName("www.macfaq.com ");
InetAddress spacecadet = InetAddress.getByName("spacecadet.cnet.com");
if (macfaq.equals(spacecadet)) {
System.out.println
("www.macfaq.com is the same as spacecadet.cnet.com");
}
else {
System.out.println
("www.macfaq.com is not the same as spacecadet.cnet.com");
}
}
catch (UnknownHostException e) {
System.out.println("Host lookup failed.");
}