Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

creating files in directory

 
sanj singh
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All
How can I create files e.g. page1.html,page2.html etc. using a for loop in a particular directory.
regards
sanj
 
amudha chinnaswamy
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
import java.io.*;
class FileDemo{
public static void main(String[]args){
try{
for(int i=0;i<5;i++){
FileWriter out = new FileWriter("d://html/Page"+i+".html");
out.write("Test Report");
out.close();
}
}catch(Exception e){
System.out.println("Exception");
}
}
}
 
You guys wanna see my fabulous new place? Or do you wanna look at this tiny ad?
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!