macfaq.java

来自「JSON(javascript) object creator and exam」· Java 代码 · 共 30 行

JAVA
30
字号
/* Since the book was written, www.macfaq.com has moved off ofspacecadet.cnet.com onto a new host. Thus if you run this youwon't get the results shown in the book. */import java.net.*;class macfaq {  public static void main (String args[]) {    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.");    }  }}

⌨️ 快捷键说明

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