inetaddressdemo.java

来自「利用Socket编写的一个一对一聊天的程序」· Java 代码 · 共 32 行

JAVA
32
字号
/* * InetAddressDemo.java * * Created on 2007年11月13日, 下午11:22 * * To change this template, choose Tools | Options and locate the template under * the Source Creation and Management node. Right-click the template and choose * Open. You can then make changes to the template in the Source Editor. */package 一对一聊天;import java.net.*;class InetAddressDemo{    public static void main (String [] args) throws UnknownHostException    {    String host = "localhost";    if (args.length == 1)    host = args [0];    InetAddress ia = InetAddress.getByName ("www.baidu.com");    System.out.println ("Canonical Host Name = " +    ia.getCanonicalHostName ());        System.out.println ("Host Address = " +    ia.getHostAddress ());        System.out.println ("Host Name = " +    ia.getHostName ());        System.out.println ("Is Loopback Address = " +    ia.isLoopbackAddress ());}}

⌨️ 快捷键说明

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