错误提示是这样的:
The method setRequestMethod(String) is undefined for the type Object
程序的代码是:
public static String doGet(String msg){
String result="";
String url=setParams(msg);
try {
java.net.URL urlNet=new java.net.URL(url);
HttpURLConnection conn= (HttpURLConnection) urlNet.openConnection();
((URLConnection) conn).setReadTimeout(5*1000);
((URLConnection) conn).setConnectTimeout(5*1000);
((Object) conn).setRequestMethod("GET");
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return result;
}