How can I pass List in my method parameter?
Change the method definition to something as follows
public static void function(int number, List<String> listname) {
for (int i = 0; i < listname.size(); ++i) {
System.out.print(listname.get(i) + ": ");
}
System.out.println(number);
}