i'm learning code java , encountered problems in use understanding how things work.
i've made list containing "images", on main class, called "mylist".
public class main{ public static void main(string[] args) { list<images> mylist = new arraylist<images>(); ...
and want access on "system" class. doesn't seem let me. plan access position (the 3rd, in example) on given list (list.get(2)). created method "work".
//example public class system{ public static boolean work(list<images> list){ if( list.get(2).equals(something) ) return false; else ... return true; }
on same system class i'm trying use method "work", giving list created on main class (mylist).
public class system{ ... if( work(mylist) ) //don't know how reffer mylist return something;
gives me error "mylist cannot resolved variable". problem how reffer list made on main, named "mylist".
not sure if explained suggestions?
make list property of system class, pass in constructor
public class system { private list<images> images; public system(list<images> images) { this.images = images; } //your other methods }
ah, in main should pass list:
system system = new system(mylist);
Comments
Post a Comment