import java.net.*;

public class TestInet1 {
public static void main(String argv[])
{
try {
InetAddress myip = InetAddress.getLocalHost();

System.out.println(myip.getHostName());
System.out.println(myip.getHostAddress());
} catch (UnknownHostException e) {
System.out.println("Error: unable to resolve localhost");
}
}
}

 

 

文章標籤
全站熱搜
創作者介紹
創作者 沈峻璿 的頭像
沈峻璿

qwerty6756的部落格

沈峻璿 發表在 痞客邦 留言(0) 人氣(0)