在每次迭代中,创建一个线程“student”。因为这些线程都被命名为“学生”。 Java可以理解这些是不同的线程吗?
while (true) {
System.out.println("Waiting for client...");
// open client socket to accept connection
client = server.accept();
System.out.println(client.getInetAddress()+" contacted ");
System.out.println("Creating thread to serve request");
ServerStudentThread student = new ServerStudentThread(client);
student.start();
}
答案 0 :(得分:34)