I wrote a small program to check the given movie name exist in a folder. I am getting the warning on eclipse "the value of local variable is not used"
Here is the main method
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);
}
}
I get the warning against this variable declaration
boolean movie_exist=false;
I have assign a value to the variable.
movie_exist = newfolrder.checkMovieExist("Breaking Bad");
Why do I get this warning?
falsevalue assigned tomovie_existis never used before it is overwritten.