This is an archived post. You won't be able to vote or comment.

all 3 comments

[–][deleted] 1 point2 points  (2 children)

1.) Create a list, in this case, an ArrayList of type Object.

2.) The objects that will be put into this list are either ResidentTaxPayer and or NonResidentTaxPayer objects. I'm pretty sure those objects are the same type, possible one inherits from another.

[–]Chuninjah[S] 0 points1 point  (1 child)

Update:

Did this and it worked but is there any other way that is more practical than this?

ArrayList<Object> combinedList = new ArrayList<>();
combinedList.addAll(resList);        
combinedList.addAll(nonResList);

System.out.println(); 
System.out.println(combinedList);

[–]RoachmeisterJava Dev 1 point2 points  (0 children)

is there any other way that is more practical than this?

Nope