Open certain number of files java -


i want open x number of file(s) when user prompts file. if user decides open file1, file1 display. if file3 prompt, file1 file3 display , etc. how can go doing this?

system.out.print("pick file open:"); string promptfile = keyboard.nextline(); scanner filenumber = new scanner(new file(promptfile )); 

you can store filenames in string array:

string [] filenames = {"file1", "file2", "file3"} //etc 

then need run loop loop variable ranging 1 promptfile, inside loop have go thru each member of filenames , open display.


Comments