java - How to Set file variable name on execution -



java - How to Set file variable name on execution -

how allow user decide file name when running program?? file name assigned variable called "f" , hardcoded, how run programme , point file @ same time....for illustration

how assign "f"??

system.out.println("usage: java checkbalanced ");

listreferencebased stack = new listreferencebased(); int exception=0; file f=new file("ef.txt"); filereader fr = null; seek { fr = new filereader(f); } grab (filenotfoundexception e) { e.printstacktrace(); }

first, alter usage message like

system.out.println("usage: java checkbalanced <file>");

then,

file f=new file((args.length < 1) ? "ef.txt" : args[0]);

java io linked-list

Comments

Popular posts from this blog

javascript - I need to update the text of a paragraph by inline edit -

javascript - THREE.js reposition vertices for RingGeometry -

assembly - What is the addressing mode for ld, add, and rjmp instructions? -