?? dnsclient.java
字號:
import java.net.*;
import java.io.*;
public class DNSClient {
// Input a string
public static String readLine()
throws IOException {
BufferedReader br =
new BufferedReader(new InputStreamReader(System.in));
return br.readLine();
}
// Prompt for and input a string
public static String readLine(String prompt)
throws IOException {
System.out.print(prompt);
return readLine();
}
// Main program
public static void main(String args[])
throws IOException {
System.out.println("Enter strings when prompted(本程序實現域名與IP之間的轉化).");
System.out.print("Enter internet Host name: ");
String s1 = readLine();
try{InetAddress address=InetAddress.getByName(s1);
System.out.println(address.toString());
}
catch(UnknownHostException e)
{System.out.println("無法找到"+s1);}
// String s2 = readLine("Enter internet Host name: ");
//System.out.println("Your name: " + s1 + " " + s2);
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -