Ecco a te Marco! ;)
import java.util.InputMismatchException;
import java.io.*;
import java.lang.*;
import java.util.*;
public class leggi
{
public static void main(String[] args)
throws IOException
{
String i;
Scanner scanner = new Scanner(System.in);
FileOutputStream outF = null;
try {
if (args.length != 1)
System.out.println ("Omesso parametro per file");
else {
System.out.print("Inserisci Testo : ");
i = scanner.next();
outF = new FileOutputStream (args[0]);
int j=0;
while (j<i.length())
{
outF.write(i.charAt(j));
j++;
}
}
outF.close();
}
catch(InputMismatchException ex)
{
System.out.println(ex);
}
finally
{
scanner.close();
} } }