You can apply your Query
to as many shapefiles as you like just loop through them and keep adding to the feature collection where you are storing the answers.
So in pseudocode:
collection = new List
for file in shapefiles:
collection.add(file.queryResult(query));
writeShapefile(collection);
You can actually use a normal Java ArrayList (or Set) to store the results in and then use a ListFeatureCollection to write them out.
FeatureCollection features = new ListFeatureCollection(schema, feats);
Caveat: All your shapefiles must have the same contents (or your Query must only extract the common attributes). See my answer to this question for an example of ShapeFile writing.