Thursday, 28 April 2011

JAVA PROGRAM TO DISPLAY DOMAIN NAME SERVICE


import java.net.*;
 
class dns
{
 public static void main(String args[]) throws Exception
 {
  try
  {
   InetAddress[] address=InetAddress.getAllByName("java.sun.com");
   for(int j=0;j<address.length;j++)
   System.out.println(address[j]);
  }
 
  catch(Exception e)
  {
   System.out.println("Error in accessing Internet :"+e);
  }
 }
}

No comments:

Post a Comment