0

how are objects passed into methods

12th Aug 2016, 6:08 AM
sudheer chintada
sudheer chintada - avatar
2 Antworten
0
public void xyz (int x, int y, int x) xyz (1,2,3);
12th Aug 2016, 6:21 AM
Eric Zeus
Eric Zeus - avatar
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); }
12th Aug 2016, 4:27 PM
jax502