📄 j_inetaddress.java
字号:
import java.net.InetAddress;
import java.net.UnknownHostException;
public class J_InetAddress
{
public static void main(String[] args){
String s="www.buaa.edu.cn";
InetAddress ts=null;
try{
ts=InetAddress.getByName(s);
}
catch(UnknownHostException e){
System.err.println(e);
}
if(ts!=null){
System.out.println("The IP address of beihang is :"+ts.getHostAddress());
System.out.println("The host name of beihang is :"+ts.getHostName());
}
else{
System.out.println("can not access "+s);
}
}
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -