Java return a value from a method - beginner
<p>I am really a beginner in Java and I would be grateful if someone could explaine me how can I get a return from my method in order to use it in another class from where I actually call the following one. My code is:</p>

<pre><code>private static String[] months(int val){

    String[] monthsNames = { "January", "February", "March", "April", 
            "May", "June", "July", "August", "September", "October", 
            "November", "December"};

                   return monthsNames[val];
}
</code></pre>

<p>edit: I did</p>

<pre><code>public static String months(int val){

    String[] monthsNames = { "January", "February", "March", "April", 
            "May", "June", "July", "August", "September", "October", 
            "November", "December"};

                   return monthsNames[val];
}
</code></pre>

<p>and what I get from eclipse is that monthsNames cannot be resolved to a variable</p>

<p>edit2**
now it works. Thanks everybody for your help!</p>