How to Create Whole Path Automatically and write into File In Java

        File file = new File("/home/anand/Desktop/filename.html");
        file.getParentFile().mkdirs();
        FileWriter writer = new FileWriter(file);
       
        bw = new BufferedWriter(writer);
        PrintWriter  out = new PrintWriter(bw);
        out.println("<h4>Welcome in Bangalore</h4>");
        out.close();

Comments

Popular posts from this blog

Converting JSONArray into CSV file in java

Java Design pattern

Map class field to map