i want make method takes x amount of arraylist<> parameter. when use args not work. args reserved int , string etc? why not args become new array containing arraylist? thought there way able give multiple parameter values method turns array inside method?
arraylist<string> list1 = new arraytlist(); list1.add("1"); arraylist<string> list2 = new arraylist(); list2.add("2"); list2.add("3"); a print method:
public void print(arraylist<string> args){ for(int = 0; < args.length; i++){ for(int j = 0; j < args[i].size(); j ++){ system.out.println(args[i].get(j)); } } } does not work
printelements takes single parameter of type arraylist<string>, you're trying give 2 arguments of type arraylist.
Comments
Post a Comment