⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lookup.java

📁 < 网络机器人java编程指南>>的配套源程序
💻 JAVA
字号:
import java.net.*;/** * Example program from Chapter 1 * Programming Spiders, Bots and Aggregators in Java * Copyright 2001 by Jeff Heaton * * A simple class used to lookup a host name using either * an IP address or a host name and to display the IP * address and hostname for this address. This class can * be used both to display the IP address for a host name, * as well as do a reverse IP lookup and  * give the host * name for an IP address. * * @author Jeff Heaton * @version 1.0 */public class Lookup {  /**   * The main function.   *   * @param args The first argument should be the   * address to lookup.   */  public static void main(String[] args)  {    try {      if ( args.length==0 ) {        System.out.println(                          "Call with one parameter that specifies the host " +                          "to lookup.");      } else {        InetAddress address = InetAddress.getByName(args[0]);        System.out.println(address);      }    } catch ( Exception e ) {      System.out.println("Could not find " + args[0] );    }  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -