Is it possible to return variables from inside of a try block to the the main scope of the class?
<p>I'm trying to get a handle on Java's error handing. Is it possible to have small try/catch blocks that do one thing and then return the result of it's operation back to the main scope? </p>

<p>It seems like <em>everything</em> has to go inside of the try block, which seems a little odd. </p>

<p>I've set up the following test: </p>

<pre><code>public class test {
    public static void main(String[] args) {
        System.out.println(0-10);
        int guess;
        try {
            guess = 5;
        }
        catch(Exception ex) {
            System.out.println("bugger");
        }
        System.out.println(guess);
    }
}
</code></pre>

<p>Just for sake of example, I declare a variable, and then assign it a value inside of the try block, but it seems to only exist inside of the try block. Trying to print it outside of the try results in an error. Is there a way to pass information out of the try? </p>
