public Server(){
try{
while (true){
socket = ss.accept();
in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
out = new PrintWriter(socket.getOutputStream(),true); String line = in.readLine();
out.println("you input is :" + line);
out.close();
in.close();
socket.close();
}
}
catch (IOException e){}
finally{
try {
ss.close();
} catch (IOException e) {}
}
}
还有ss.close();什么时候会执行呢?(这个程序只能Ctrl+C退出)
一个方法,在它的中间出现了一个无条件返回语句,将会引起一个便宜错误:
if (1 < 2)
return;
// unreachable statements
本文出自 51CTO.COM技术博客