```
public class Demo
{
    public static void main(String[] args)
    {
        PrintWriter outputStream= null;
        try
        {
            outputStream = new PrintWriter (new BufferedWriter(new PrintWriter("text.txt")));
        }
        catch(FileNotFoundException e)
        {
            System.out.println("Error");
            System.exit(0);
        }
        finally {
                if (outputStream!= null)
                    outputStream.close(); 
        }

        outputStream.println("Hahahahaha");

    }
}

```

So I was given this sample code, but strangely it doesn't work at all, because when I open the text file. It's completely blank. How's that possible? Is it because of the output.close? I commented that part out, but it still doesn't work.