小弟不才
  想问下为什么编译老是错误
  ##########################################
  package org.qj; 
   
  import java.io.*; 
  import java.net.*; 
   
  /** 
   * 刷新服务器动态域名IP 
   */ 
  public class RefreshIP { 
   final String host = "lahan.3322.org";//你的动态域名
   String last_ip = ""; 
   
   public void run() { 
   //解析lahan.3322.org 
   InetAddress address = null; 
   try { 
   address = InetAddress.getByName(host); 
   } catch (UnknownHostException e) { 
   System.out.println("Unknown host"); 
   return; 
   } 
   byte[] _ip = address.getAddress(); 
   for (int i = 0; i < _ip.length; i++) { 
   if (i > 0) last_ip += "."; 
   last_ip += _ip[i] & 0xFF; 
   } 
   System.out.println(host+" [" + last_ip + "]"); 
   
   while (true) { //获取当前外网ip 
   String content = getPageContent(http://www.net.cn/static/customercare/yourIP.asp, 64 * 1024); 
   String match = "您的本地上网IP是:<h2>"; 
   assert content != null; 
   int index = content.indexOf(match) + match.length(); 
   String ip = content.substring(index, content.indexOf("</h2>", index)); 
   System.out.println("当前外网ip = " + ip); 
   
   if (last_ip.equals(ip)) return; 
   //发送刷新ip请求 
   StringBuffer sb = new StringBuffer(); 
   sb.append("GET /dyndns/update?system=dyndns&hostname=" + host + "&myip=" + ip + " HTTP/1.1\r\n"); 
   sb.append("Host: www.3322.org\r\n"); 
   sb.append("Authorization: Basic dG9wbWludDo1ODYxNzcz\r\n"); // "byhuai:020160" base64
   sb.append("User-Agent: myclient/1.0 [email protected]\r\n\r\n"); 
   Socket connection = null; 
   
   try { 
   connection = new Socket("www.3322.org", 80); 
   Writer out = new OutputStreamWriter( 
   connection.getOutputStream(), "8859_1"); 
   out.write(sb.toString()); 
   out.flush(); 
   
   InputStream raw = connection.getInputStream(); 
   BufferedInputStream buffer = new BufferedInputStream(raw); 
   InputStreamReader in = new InputStreamReader(buffer, "8859_1"); 
   int c; 
   while ((c = in.read()) != -1) { 
   // filter non-printable and non-ASCII as recommended by RFC 1288 
   if ((c >= 32 && c < 127) || c == '\t' || c == '\r' || c == '\n') { 
   System.out.write(c); 
   } 
   } 
   } 
   catch (IOException ex) { 
   System.err.println(ex); 
   } 
   finally { 
   try { 
   if (connection != null) connection.close(); 
   } 
   catch (IOException ex) { 
   } 
   } 
   try { 
   wait(60 * 1000); 
   } catch (InterruptedException e) { 
   e.printStackTrace(); 
   } 
   } 
   } 
   
   public static String getPageContent(String strUrl, 
   int maxLength) { 
   //读取结果网页 
   StringBuffer buffer = new StringBuffer(); 
   System.setProperty("sun.net.client.defaultConnectTimeout", "5000"); 
   System.setProperty("sun.net.client.defaultReadTimeout", "5000"); 
   try { 
   URL newUrl = new URL(strUrl); 
   HttpURLConnection hConnect = (HttpURLConnection) newUrl 
   .openConnection(); 
   
   //读取内容 
   BufferedReader rd = new BufferedReader(new InputStreamReader( 
   hConnect.getInputStream())); 
   int ch; 
   for (int length = 0; (ch = rd.read()) > -1 
   && (maxLength <= 0 || length < maxLength); length++) 
   buffer.append((char) ch); 
   rd.close(); 
   hConnect.disconnect(); 
   return buffer.toString().trim(); 
   } catch (Exception e) { 
   e.printStackTrace(); 
   return null; 
   } 
   } 
  } 
  #########################################################
  C:\Program Files\Java\jdk1.7.0\bin>javac c:\java.java
  c:\java.java:30: 需要 ')'
   String content = getPageContent(http://www.net.cn/static/customercar
  e/yourIP.asp, 64 * 1024);
   ^
  1 错误
  #######################################################
  哪里有错误`望高人指点

解决方案 »

  1.   

    此回复为自动发出,仅用于显示而已,并无任何其他特殊作用
    楼主【wa335】截止到2008-07-14 08:57:57的历史汇总数据(不包括此帖):
    发帖的总数量:0                        发帖的总分数:0                        每贴平均分数:0                        
    回帖的总数量:0                        得分贴总数量:0                        回帖的得分率:0%                       
    结贴的总数量:0                        结贴的总分数:0                        
    无满意结贴数:0                        无满意结贴分:0                        
    未结的帖子数:0                        未结的总分数:0                        
    结贴的百分比:---------------------结分的百分比:---------------------
    无满意结贴率:---------------------无满意结分率:---------------------
    如何结贴请参考这里:http://topic.csdn.net/u/20080501/09/ef7ba1b3-6466-49f6-9d92-36fe6d471dd1.html
      

  2.   

    String content = getPageContent("http://www.net.cn/static/customercare/yourIP.asp", 64 * 1024); 
      

  3.   

    getPageContent(http://www.net.cn/static/customercar
      e/yourIP.asp, 64 * 1024)这个地方需要用引号括起来,表明是字符串。
      

  4.   

    30行,字符串要用引號引起來
    String content = getPageContent("http://www.net.cn/static/customercar
      e/yourIP.asp", 64 * 1024)