如果我们有以下代码:
Process p = null;
BufferedReader br = null;
try{
p = Runtime.getRuntime().exec("ps -ef");
br = new BufferedReader(new InputStreamReader(p.getInputStream()));
//Do something with br
} catch (Exception e) {
//Handle catch block
} finally {
//Do we need to set p = null;
}
在 finally 块中是否需要 p = null 或默认关闭所有关联的流?