本帖最后由 张向辉 于 2013-1-16 12:37 编辑
为什么明明按照视频一模一样,new ServerSocket()还会编译不通过,求分析
import java.net.*;
import java.io.*;
class ServerSocket
{
public static void main(String[] args) throws Exception
{
ServerSocket ss = new ServerSocket(10009);
Socket s = ss.accept();
InputStream in = s.getInputStream();
byte[] buf = new byte[1024];
int len = in.read(buf);
System.out.println(new String(buf,0,len));
PrintWriter out = new PrintWriter(s.getOutputStream(),true);
out.println("<font color='green' size='7'>注册成功</font>");
s.close();
ss.close();
}
}
|
|