没办法new URL了….

J2EE 码拜 9年前 (2015-05-11) 1263次浏览 0个评论
 

URL url =URL(path);     这个语句老是在后面那个“URL”那报错,提示为The method URL(String) is undefined for…

照着视频敲得,没搞懂为什么会出错。

import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.*;
import android.R.bool;

public class LoginService {
	public static boolean loginByGet(String username,String password){
		try {
			String path ="http://192.168.1.100:8080/web/LoginServlet?username="+username+
					"&password="+password;
			URL url =URL(path);
			return true;
		} catch (IOException e) {
			e.printStackTrace();
			return false;
		}
	}
}

有人遇到过一样的情况吗

40分
URL url =URL(path);
URL url =new URL(path);
引用 1 楼 u011004037 的回复:
URL url =URL(path);
URL url =new URL(path);

。。。。低级错误  我敲糊涂了


CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明没办法new URL了….
喜欢 (0)
[1034331897@qq.com]
分享 (0)

文章评论已关闭!