create new file, ask user to write in it, save finally print content of file
1. creates a file.
2. ask user to write into that file
3. save the file
4. print content of file.
is my current exercise
so far i have gotten the code to create a file, and ask the user to input their age
what should i use to save what the user writes into the file?
public class Exercise2
public static void main ( String [ ] args ) throws IOException
Scanner scan = new Scanner(System.in);
System.out.println("New file \"myfile.txt\" has been created to the current directory.");
System.out.print("Enter your age as an integer: ");
int age = scan.nextInt();
System.out.println("Your age is " + age);
Re: create new file, ask user to write in it, save finally print content of file