जब मैंने स्रोत कोड पढ़ा java.io.BufferedInputStream.getInIfOpen()
, तो मैं इस बारे में उलझन में हूं कि इसने इस तरह कोड क्यों लिखा:
/**
* Check to make sure that underlying input stream has not been
* nulled out due to close; if not return it;
*/
private InputStream getInIfOpen() throws IOException {
InputStream input = in;
if (input == null)
throw new IOException("Stream closed");
return input;
}
यह in
नीचे की तरह सीधे क्षेत्र चर का उपयोग करने के बजाय उपनाम का उपयोग क्यों कर रहा है :
/**
* Check to make sure that underlying input stream has not been
* nulled out due to close; if not return it;
*/
private InputStream getInIfOpen() throws IOException {
if (in == null)
throw new IOException("Stream closed");
return in;
}
क्या कोई उचित स्पष्टीकरण दे सकता है?
if
बयान पर विराम नहीं लगा सकते ?
Eclipse
, आप किसीif
विवरण पर डीबगर को रोक नहीं सकते । उस उर्फ चर के लिए एक कारण हो सकता है। बस वहाँ से बाहर फेंकना चाहता था। मैं अटकलें लगाता हूं, बिल्कुल।