import java.net.*;

public class IdentifyHostNameIP {
  public static void main(String[] args) {
    for (int i = 0; i < args.length; i++) {
      try {
        InetAddress address = InetAddress.getByName(args[i]);
        System.out.print("Nazwa hosta: " + address.getHostName() + " ");
        System.out.println("Adres IP: " + address.getHostAddress());
      }
      catch (UnknownHostException ex) {
        System.err.println("Nieznany host lub adres IP: " + args[i]);
      }
    }
  }
}
