public class Aa {
/**
 * @param args
 */private static URL urlStr;
private static HttpURLConnection connection;
private static int state = -1;
private static String succ;public static  String isConnect() {int counts = 0;
succ = null; //if ("http://www." == null || "http://www.".length() <= 0) { return succ; }
while (counts < 1) {
try {
urlStr = new URL("http://www.baidu.com");
connection = (HttpURLConnection) urlStr.openConnection();
state = connection.getResponseCode();
if (state == 200) {
succ = connection.getURL().toString();
}
break;
} catch (Exception ex) {
counts++; 
continue;
}
}
return succ;
}public static void main(String[] args){
    System.out.println(Aa.isConnect());
}

这个程序我测试过了, 不过http://www.  ,这个地址是不存在的,为什么也返回 200  呢?请教各位大侠