The folloring example defines a variable x within a try/catch block and
then tries to access it outside of the block, which results in an undefined
variable error!
try
{
long x = 5;
x = x * 10; // ok
}
catch ( Exception e ) {}
x = x + 9; // error! undefined variable!
The variable x is only valid within the try/catch block. To fix, do this:
long x = 5;
try
{
x = x * 10; // ok
}
catch ( Exception e ) {}
x = x + 9; // ok