java这种语法是啥意思?菜鸟问题 这么写是什么意思?a a=new a(){};大括号里代表什么? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 {}大括号里有n多代码的,这里是源代码Thread t = new Thread() { Socket client_connection = serverSocket.accept(); public void run() { try { InputStream input = client_connection.getInputStream(); OutputStream output = client_connection.getOutputStream(); BufferedReader rd = new BufferedReader( new InputStreamReader(input)); String line = rd.readLine(); HashMap header = new HashMap(); do { line = rd.readLine(); if (line.length() == 0) { break; } int idx = line.indexOf(":"); if (idx >= 0) { String name = line.substring(0, idx).trim(); String value = line.substring(idx + 1).trim(); header.put(name, value); } else { System.err.println( "Unknown header : " + line); } } while (true); String inum = (String) header.get("INUM"); String address = client_connection .getInetAddress() .getHostAddress(); Communicator c = new Communicator(); c.service(address + inum, input, output); } catch (IOException e) { e.printStackTrace(); } finally { if (client_connection != null) { try { client_connection.close(); } catch (IOException e1) { e1.printStackTrace(); } } } } }; socket.close()但是线程中不抛出异常?请问有些什么原因 如果我想在swing里调用一个ejb 一个txt读写卡死问题 有个不简单的正则,帮忙看看。 一个简单的java线程问题 如何在按钮上添加图片^-^ 指教 我想知道JAVA怎样连接远程打印机? 请问一下,在服务器上读写其他IP的某个端口,会不会受到本地防火墙的限制,要怎样解决? 如何固定一个按钮的大小?用setSize()不好用,可能是随着面板的大小在变,给面板再用setSize()还是不好用,哪位高手帮我一把,急! 请您给我一些建议?(谢谢) 高分求助按钮问题,分不够再加!在线等待 集合排序问题
Thread t = new Thread() {
Socket client_connection = serverSocket.accept();
public void run() {
try {
InputStream input =
client_connection.getInputStream();
OutputStream output =
client_connection.getOutputStream();
BufferedReader rd =
new BufferedReader(
new InputStreamReader(input));
String line = rd.readLine();
HashMap header = new HashMap();
do {
line = rd.readLine();
if (line.length() == 0) {
break;
}
int idx = line.indexOf(":");
if (idx >= 0) {
String name = line.substring(0, idx).trim();
String value =
line.substring(idx + 1).trim();
header.put(name, value);
} else {
System.err.println(
"Unknown header : " + line);
}
} while (true);
String inum = (String) header.get("INUM");
String address =
client_connection
.getInetAddress()
.getHostAddress();
Communicator c = new Communicator();
c.service(address + inum, input, output);
} catch (IOException e) {
e.printStackTrace();
} finally {
if (client_connection != null) {
try {
client_connection.close();
} catch (IOException e1) {
e1.printStackTrace();
}
}
}
}
};