Okay, so I have an arraylist declared in my main because elsewhere it brings up an error. However, I want to use that arraylist later specifically to have a getter, but it doesn't recognize the arraylist because it is in my main.
The error is
"it cannot be resolved to a variable"
.
What can I do to correct this?
public static void main(String[] args) {
ArrayList <String> Strings = new ArrayList <String>();
Strings.add("hi");
Strings.add("hello");
Strings.add("goodbye");
}
public ArrayList<String> getArrList() {
return Strings;
}