I have the following program:
public static void veureinfo(String filePath) throws FileNotFoundException{
// creem l'objecte
File origen = new File(filePath);
/**
* Si es directori llavors:
*/
if (origen.isFile()){
Basically the program takes me the argument of the program and uses it.
But, what if I want to give the argument as a console? That is, can it be ordered with the class Scanner
? The idea is that my program is like the Windows CMD ... so I need the user to decide which argument he wants to look for and my program finds it.
How is it done?
File ruta = new File ("C/");
File f = new File (ruta, ?????);
How do I get Scanner to create a file for me?
Scanner lector = new Scanner (System.in);
??? = lector.next?????