Suppose you run this program.
In line 5 you declare a local variable
token, but you do not initialize it.
Suppose that in line 7 an exception occurs.
Execution jumps to line 12, where the stack trace of the exception is printed.
Then line 14 is executed. Note that the variable
token has not yet been initialized!
In
Java, it is required to initialize local variables before using them. Whenever the compiler finds a code path where it is possible to use a local variable without initializing it first (such as described above), you get an error from the compiler.
Note that the member variable, declared in line 3, is not used at all in your program. The local variable declared in line 5 hides it.