dnsclient.java.bak

来自「DNS Client和SMTP Client」· BAK 代码 · 共 36 行

BAK
36
字号
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 your last name: ");
  //System.out.println("Your name: " + s1 + " " + s2);
 }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?