📄 inetaddressdemo.java
字号:
//InetAddress Test
import java.net.*;
class InetAddressDemo {
public static void main(String[] args) throws UnknownHostException{
InetAddress addr = InetAddress.getLocalHost();
byte[] b = addr.getAddress();
System.out.println( "getByAddress() is " + addr.getByAddress(b));
System.out.println( "getCanonicalHostName() is " + addr.getCanonicalHostName());
System.out.println( "getHostName() is " + addr.getHostName());
System.out.println( "getHostAddress() is " + addr.getHostAddress());
System.out.println( "getLocalHost() is " + InetAddress.getLocalHost());
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -