我只是試圖做一個簡單的類,它讓我找出一個文件的長度:運營商是不確定的
public class Size {
long s = 0;
int a;
public static void main(String[]args){
new Size();
}
Size(){
try{
FileInputStream str = new FileInputStream("E:/Eclipse/Resources/smile.jpg");
while(a != null){
s++;
}
}catch (IOException e){
e.printStackTrace();
}
}
}
我碰到一個問題
while(a != null)
我得到的錯誤:
The operator != is undefined for the argument type(s) int, null
任何想法爲什麼它阻止了這種情況?
因爲'int'不能'null'。 – chris 2013-04-20 19:22:11