Question: Supposedly the user will enter their "ID #: 1203103" then after that it will automatically create a text file named 1203103.txt How can I do that? Here is my code. what will I change in my code?

```
String id = scan.nextLine();
File file = new File(id.txt);
FileWriter fileWrite = new FileWriter(file);
BufferedWriter bufferedWriter = new BufferedWriter(fileWrite);

```

Answer: 
you can't use `File file = new File(id.txt);` as it takes string argument.so you can make a `string` like `id+".txt"` and then pass it to `new file();`

```
String id = scan.nextLine();
File file = new File(id+".txt");
FileWriter fileWrite = new FileWriter(file);
BufferedWriter bufferedWriter = new BufferedWriter(fileWrite);

```
This is a different approach by using [try with resource](http://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html)

```
String id = scan.nextLine();
try(BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(new File(id + ".txt")))
{
}
catch(Exception e)
{
}

```