0
how are objects passed into methods
2 Antworten
0
public void xyz (int x, int y, int x)
xyz (1,2,3);
0
Here is a method that accepts a String object and a List of Integer object:
public class Test {
public static void myMethod(String strObj, List<Integer> listObj) {}
}
Here is how you call that method and pass your objects to it:
public static void main(String[] args) {
String strObj ="Hello";
List<Integer> listObj = new ArrayList<Integer>();
listObj.add(1);
listObj.add(2);
Test.myMethod(strObj, listObj);
}