আমি যখন থেকে উত্স কোডটি পড়ি, তখন 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বিবৃতিতে কোনও ডিবাগার থামাতে পারবেন না । সেই উরফ ভেরিয়েবলের কারণ হতে পারে। ঠিক আছে যে নিক্ষেপ করতে চেয়েছিলেন। আমি অনুমান অবশ্যই।