Thanks for the suggestions. However, this is actually for a homework assignment and it requires that it includes a method that accepts four objects as parameters. A array/list like that would work but if let's say I only have control of the method and nothing else outside the method, then the outside user could easily invoke my method and pass an array or list of 5, 9, 2, etc elements (which breaks the requirement for the assignment.)
Originally Posted by Coold0wn
I know I can access the length of the array with length but I can only access the length of the array once it has been passed to the method, I can't restrict the length of the array being passed to the method. However, if my professor isn't a stickler about the requirements, I could let the user pass an array to the method and test the length of the array and then throw an exception if length != 4.
Originally Posted by pbrockway2
I guess I could hard code it like below. However, I'm quite saddened by the fact that if theoretically the method had 1000 parameters, the below method wouldn't be efficient (in terms of the length of time it takes to type) and I wouldn't be able to find another alternative solution.
public static void doStuff(Object obj0, Object obj1, Object obj2, Object obj3)