What is wrong with my coding? I tried to create a file name & printout in the text file package practical12;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.Scanner;
public class q4 {
public static void main (String []args) throws FileNotFoundException{
System.out.println("please input file name");
String name;
//take file name
Scanner in;
in = new Scanner(System.in);
name = in.nextLine();
PrintWriter out = new PrintWriter(name);
// create textfile
out.println("Hello! My first program in File");
// write the text
out.close();
//close the file
}
}