日期:2014-05-20 浏览次数:20592 次
public static boolean checkUrl(String url){ try { HttpURLConnection con = (HttpURLConnection)new URL(url).openConnection(); int respCode = con.getResponseCode(); return respCode==404 ? false : true; //return respCode!=200 ? false : true; } catch (Exception e) { e.printStackTrace(); return false; } }