我有以下代码:
public class Utils{
public static void closeQuietly(Closeable c){
try{c.close();} catch(Exception e){}
}
public static void main(String [] args){
Closeable cl = new Socket();
closeQuietly(cl);
}
}
这看起来很简单,但由于某种原因,我收到以下编译器错误:
error: cannot find symbol
closeQuietly(cl);
^
symbol: method closeQuietly(Closeable)
location: class Utils
我不明白为什么。