找考题网-背景图
单项选择题

在J2EE中,为了使得在客户端可以接收用户在控制台上的键盘输入,且把键盘输入发送到服务器,同时还要接收服务器给客户端的反馈,需要构造三个用于输入输出的对象变量,以下代码符合要求的是()。其中clientSocket是一个Socket类的对象。     

A.BufferedRead br1 = System.in; BufferedRead br2 = new BufferedReader(clientSocket.getInputStream())); PrintStream ps = new PrintStream(clientSocket.getOutputStream());
B.BufferedReader br1 = new BufferedReader(new InputStreamReader(System.in));BufferedReader br2 = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));PrintStream ps = new PrintStream(clientSocket.getOutputStream());
C. BufferedRead br1 = new InputStreamReader(System.in); BufferedReader br2 = newInputStreamReader(clientSocket.getInputStream()); PrintStream ps = new PrintStream(clientSocket.getOutputStream());
D. BufferedReader br1 = new BufferedReader(new InputStreamReader(System.in));BufferedReader br2 = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); PrintStream ps = clientSocket.getOutputStream();

热门试题