import java.io.FileNotFoundException; import java.io.PrintWriter; import java.util.Scanner; public class exerc1 { public static void main(String[] args) throws FileNotFoundException { // Prompt for the input and output file names Scanner console = new Scanner(System.in); System.out.print("Output file: "); String outputFileName = console.nextLine(); System.out.println(); // Construct the Scanner and PrintWriter objects for reading and writing PrintWriter out = new PrintWriter(outputFileName); // Read the input and write the output boolean inputIsOk; do{ System.out.print("Digite o nome a ser salvo [0 para sair]: "); String name=console.nextLine(); System.out.println(); inputIsOk=(! Character.isDigit(name.charAt(0))); if(inputIsOk) out.println(name); }while (inputIsOk); out.close(); } }