繼續拋出無法找到.readLine的符號我嘗試了variouse聲明和分配模式,並使用了多個不同的導入語句。我的基本服務器程序找不到.readLine(),同時指定一個字符串變量
import java.net.*;
import java.io.*;
import java.util.Scanner;
import java.io.DataInputStream ;
public class Server {
public static void main (String [] args)throws IOException {
ServerSocket servSock = new ServerSocket (8765);
System.out.println("Waiting for connection... ");
Socket sock = servSock.accept();
System.out.println("Connection established with client"
+ sock.getInetAddress().getCanonicalHostName());
Scanner inFromClient = new Scanner
(new InputStreamReader(sock.getInputStream()));
PrintWriter outToClient = new PrintWriter
(new OutputStreamWriter(sock.getOutputStream()), true);
String filename = inFromClient.readLine();
我已嘗試並在此之後抓住。