I have a Java file question. I have two Java file. File1.java
and File2.java. Both files are identical but in different location.
In both files, I am write the string into a data.html file using the
following code.
File1.java
String FileName = File.separatorChar + "Temp" + File.separatorChar
+ "data.html" ;
fos = new FileOutputStream(FileName );
oos = new DataOutputStream(fos);
oos.writeBytes("File1" + "\n");
File2.java
String FileName = File.separatorChar + "Temp" + File.separatorChar
+ "data.html" ;
fos = new FileOutputStream(FileName );
oos = new DataOutputStream(fos);
oos.writeBytes("File2" + "\n");
Now, the problem I am having is the following
I run the File1.java and "File1" string get write into a data.html
file.
Now, I run the File2.java and "File2" string get write into a
data.html file.
The problem is : when I run the File2.java file then It overrite
the "File1" string
Does anyone have any idea of how would I print both string "File1"
and "File2". Please let me know, Thank you for your help.