import java.io.*;
import java.net.*;
public class WhoIs
   {
   /**
   * Find out ip/hostnames given a domain or IP.
   *
   * @param args domain you wish to lookup on the command line:
   * e.g. mindprod.com or 209.139.205.2.
   */
   public static void main ( String[] args )
      {
      if ( args.length == 1 )
         {
         String domain = args[0];
         try
            {
            InetAddress addr = InetAddress.getByName(domain);
            out.println( "mainIPAddress:" + addr.getHostAddress ());
            out.println( "mainhostname:" + addr.getHostName () );
            out.println();
            ...