netWork_progrmming(网络信息语法)

水了一波,后续会补充

NetWork

public class IneterAddressTest {
    @Test
    public void test() throws UnknownHostException {
        //实例化ip地址(和实例化File一个意思)
        //1- 获取本机的ip地址
        InetAddress byAddress = InetAddress.getLocalHost();
        System.out.println("获取本机的ip地址= " + byAddress);
        InetAddress loopbackAddress = InetAddress.getLoopbackAddress();
        System.out.println(loopbackAddress);
    }
}

posted on 2022-06-16 11:08  陈嘻嘻-  阅读(24)  评论(0编辑  收藏  举报

导航