(java) variable scope inside try { } when accessing from finally { }?
I noticed that when the following variables when in try { }, I couldn't use methods on them from finally for example: import java.io.*; public class Main { public static void main()throws FileNotFoundException { Try{ File src = new File("src.txt"); File des = new File("des.txt"); /*code*/ } finally{ try{ /*closing code*/ System.out.print("After closing files:Size of src.txt:"+src.length()+" Bytes\t"); System.out.println("Size of des.txt:"+des.length()+" Bytes"); } catch (IOException io){ System.out.println("Error while closing Files:"+io.toString()); } } } } But when the declarations where