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:
private static String[] months(int val){
String[] monthsNames = { "January", "February", "March", "April",
"May", "June", "July", "August", "September", "October",
"November", "December"};
return monthsNames[val];
}
edit: I did
public static String months(int val){
String[] monthsNames = { "January", "February", "March", "April",
"May", "June", "July", "August", "September", "October",
"November", "December"};
return monthsNames[val];
}
and what I get from eclipse is that monthsNames cannot be resolved to a variable
edit2** now it works. Thanks everybody for your help!