-1

I'm getting the following message:

 Cannot resolve method 'println(java.lang.String)'

In the following code and have absolutely no idea why that can be the case:

import java.net.ServerSocket;
import java.net.Socket;
import java.io.DataInputStream;

public class ChatServer {
    private final Socket theSocket;
    private final ServerSocket theServerSocket;
    private final DataInputStream theDataInputStream;

    public ChatServer(Socket aSocket, ServerSocket aServerSocket, DataInputStream aDataInputStream) {
          theSocket = aSocket;
          theServerSocket = aServerSocket;
          theDataInputStream = aDataInputStream;
     }

     public void start(int port) {
          System.out.println("Whatever");
     }
}
4

1 回答 1

0

您是在使用任何 IDE 还是在记事本中编写然后编译?如果使用 IDE,请检查构建路径中是否存在 JRE 库。如果使用普通编辑器,您可能需要使用 java 库设置 CLASSPATH 环境变量。

至少<java_home>\jre\lib\rt.jar是重要的一个。

于 2013-09-14T14:02:47.123 回答