java - How do I store an input file name -


i using code below read file document (the file different). anyway possible call file name @ end of running code print file called.

here code using read in file.

    // creates file chooser , scans selected file.     scanner input = null;     file selectedfile = null;     jfilechooser chooser = new jfilechooser();     if (chooser.showopendialog(null) == jfilechooser.approve_option) {         selectedfile = chooser.getselectedfile();         input = new scanner(selectedfile);     } 

thanks in advance , if need more information ask :)

i'm not sure understand problem, maybe method you're looking getname():

string filename = selectedfile.getname(); 

if still have access file object, have name.


Popular posts from this blog