81,092
社区成员
发帖
与我相关
我的任务
分享
import java.net.HttpURLConnection;
import java.net.URL;
public class TestURL {
public static void main(String[] args) {
try {
URL url = new URL("your URL");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
if (conn.getResponseCode() == 200) {
// do something
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
URL url = new URL("your URL");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
if (conn.getResponseCode() == 200) {
// do someting
}