Unable to access a method's local variables outside of the method in Java
<p>I am new to Java and am trying to access method variables outside of the method, but it doesn't work.</p>

<p>Code is below:</p>

<pre class="lang-java prettyprint-override"><code>public class MethodAccess {
    public static void minus() {
        int a=10;
        int b=15;
    }

    public static void main(String[] args) {
        //Here i want to access variable names a &amp; b that is in minus()
        int c = b - a;
    }
}
</code></pre>