📄 net_ip_01.java
字号:
//net_ip_01.java
//10.2 04
//
import java.net.*;
//************************************************************
public class net_ip_01
{
public static void main(String[] args){
try{
if(args.length==1){
InetAddress ipa = InetAddress.getByName(args[0]);
System.out.println("Host name:" + ipa.getHostName());
System.out.println("Host IP address:" + ipa.toString());
System.out.println("Local Host:" + InetAddress.getLocalHost());
}
else
System.out.println("Please input a host name as the parameter!");
}
catch(UnknownHostException e){
System.out.println(e.toString());
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -