Exception 异常怎么改

package server;


import java.io.BufferedReader;

import java.io.IOException;

import java.io.InputStreamReader;

import java.net.ServerSocket;

import java.net.Socket;


public class ServerReader extends Thread{


private Socket socket;

private Server server;

public ServerReader(Socket socket,Server server) {

this.socket= socket;

this.server= server;

}

public void run() {

try{

BufferedReader br =new BufferedReader(new InputStreamReader(socket.getInputStream()));  

while(true) {

String str=br.readLine();

if(str.startsWith("zhuce: ")) {

String[] arr =str.split("pwd1");

String nickName =arr[1];

String pwd=arr[2];        //28行

if(!server.getUserMap().containsKey(nickName)) {

server.getUserMap().put(nickName, pwd);

System.out.println("注册成功!!");

}

else {

System.out.println("注册失败!!");

}

}

}

}

catch(IOException e) {

e.printStackTrace();

}

}

}


慕函数4285482
浏览 902回答 1
1回答

carolcoral

catch(IOException e) {  =>  catch(Exception e) {
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java