我寫了一個小程序來檢查給定的電影名稱是否存在於一個文件夾中。我正在對日食警告「局部變量的值不使用」本地變量的值不被使用
這裏的主要方法
public static void main(String[] args) {
// TODO Auto-generated method stub
boolean movie_exist=false;
System.out.println("Hellow world!");
try{
FileWriting newfolrder = new FileWriting("H:\\breakinbad2\\Breaking Bad Season 2 Complete 720p.BRrip.Sujaidr");
//movie_exist=newfolrder.checkfilesname("Movie name");
System.out.println(newfolrder.checkMovieExist("Breaking Bad"));
movie_exist = newfolrder.checkMovieExist("Breaking Bad");
}catch(NullPointerException e){
System.out.println("Exception is :"+ e);
}
}
我得到對這個變量聲明
boolean movie_exist=false;
我有警告給變量賦值。
movie_exist = newfolrder.checkMovieExist("Breaking Bad");
爲什麼我會收到此警告?
指定給'movie_exist'的'false'值在被覆蓋之前從不使用。 – August 2014-09-20 18:13:39
只要您擁有版權持有者的許可,就完全符合道德和法律。 – Basilevs 2014-09-20 19:02:46