📄 lookup.java
字号:
// Sample Jav Program// Looks up the IP address for a hostname and prints it out//import java.net.*; // need this for InetAddresspublic class Lookup { static public void main(String args[]) { // lookup the address of each hostname found on the command line for (int i=0;i<args.length;i++) { printAddress(args[i]); } } static void printAddress( String hostname ) { // use a try/catch to handle failed lookups try { InetAddress a = InetAddress.getByName(hostname); System.out.println(hostname + ":" + a.getHostAddress()); } catch (UnknownHostException e) { System.out.println("No address found for " + hostname); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -