Question about local final variable in Java

I have the following code:

public class BookLib {
    void f() {
        final int x = 5; // Line 1
        class MyCLass {
            void print() {
                System.out.println(x);
            }
        }
    }
}

I don't understand why should use final variable in this case (Line 1)?

8
задан ipkiss 10 May 2011 в 08:33
поделиться