ERROR: local variable t is accessed from within inner class need to be declared final And local variable t1 is accessed from within the class.same with t1.start(); why do I need to declare them final? 

```
public class sync {
    public int count = 0;

    public static void main(String args[]) {
        sync obj = new sync();
        obj.dowork();
        sync obj1 = new sync();
        obj1.dowork1();
        System.out.println(count);
    }

    public void dowork() {
        Thread t = new Thread(new Runnable() {
            public void run() {
                for (int i = 0; i < 1000; i++) {
                    count++;
                }
                t.start();
            }
        });
    }

    public void dowork1() {
        Thread t1 = new Thread(new Runnable() {
            public void run() {
                for (int i = 0; i < 1000; i++) {
                    count++;
                }
                t1.start();
            }
        });
    }
}

```