I programmed Java for a year and took a break to make some python in the last year. I returned to java and I am confused by some design materials.
Say I have a class that performs almost all static
public class Example{
String list = {{"A", "apple"}, {"B","banana"}, {"C", "can"}}
public static manipulateTheList(){
}
public static anotherManipulateTheList(){
}
}
And this will not allow me to use this.list, because the method is static. But I don’t think that I should define a list in a method every time, since all methods in the class will use the same list.
Is there a solution for this and what would be best practice for this kind of situation ..?
source
share