 <p>Below Code is for creating file and saving text in it .</p> <pre><code>FileOutputStream fout = new FileOutputStream("Hello.txt",true); PrintWriter pr = new PrintWriter(fout,true); pr.println("hello"); </code></pre>