scanner and arrays

hi, i have a file that can find word strings in a file using

Scanner sc =new Scanner(new File("Test.txt"));

Pattern p = Pattern.compile....

the thing is, i would like it to go through 48 different files. i'd like it to present both the total result (amount of strings found) and seperately (the amount of strings found in each file)

i have the files stored in

import java.io.*;

publicclass Mitt{

publicstaticvoid main(String[] args){

File[] corpus ={

new File("1.txt"),

new File("2.txt"),

new File("3.txt"),

new File("4.txt")//up to 48

};

for(int i = 0; i < corpus.length; i++){

findIdioms(corpus[i], corpus);

}

}

privatestaticvoid findIdioms(File essay, File[] files){

}

}

obviously it's not as easy as writing Scanner sc =new Scanner(new File("Mitt.java"));

as i thought (being a newbie) and i can't find it reading the tutorials.

Does anyone know how to solve this? if you need the entire code, i'll be happy to post it.

Thank you in advance!

[2188 byte] By [SandraPandraa] at [2007-11-27 6:14:09]
# 1
You should read up about loops
dwga at 2007-7-12 17:23:22 > top of Java-index,Java Essentials,Java Programming...
# 2
ok, will do, thanks
SandraPandraa at 2007-7-12 17:23:22 > top of Java-index,Java Essentials,Java Programming...
# 3

You're welcome, but I must admit I'm guilty of not reading your post thoroughly enough as I now see you've already got a loop that's looping over your array.

I'm guessing you want to instantiate your Scanner in the method findIdioms?

If so you can just do

Scanner sc = new Scanner(essay);

As far as I can tell there is no need to pass the entire array corpus to findIdioms.

dwga at 2007-7-12 17:23:22 > top of Java-index,Java Essentials,Java Programming...
# 4
see how easy it is to trick me ;)
SandraPandraa at 2007-7-12 17:23:22 > top of Java-index,Java Essentials,Java Programming...
# 5
Right :) sorry about that
dwga at 2007-7-12 17:23:22 > top of Java-index,Java Essentials,Java Programming...