Hi,
Can some one tell me what mistake i am doing in the below code. I want to write a log file. But the file is created without content. that is
c_objLogFile.write("we are inside");// this is not printed in the file which i am creating.
Basically i want to impement a interface which has two methods and in the implementation class i need to creat a log file and write. please can u help me
// interface
package com.cp.Bul;
public interface writetest {
public
String transformPostLoad();
public String trandformPreLoad();
}
----------------------------------------------------------------------
entryclass
-----------------------------------------------------------------------
package com.cp.Bul;
public class entryclass {
int[] arra = new int[5];
public static void main(String[] args) {
int i;
for(i=0;i<5;i++)
{writefile wf = new writefile();
wf.trandformPreLoad();
}
}
-------------------------------------------------------------------------
package com.cp.Bul;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
public class writefile implements writetest {
private FileWriter c_objLogFile;
private File file = new File ("C:\\write.txt");
private static int count =0;
public static void main(String[] args) throws IOException {
}
public String transformPostLoad() {
return "" ;
}
public String trandformPreLoad() {
System.out.println("the value of count: " + count);
count = count+1;
String source_lifecycle_state = "life";
tocalculate(source_lifecycle_state);
return "";
}
private void tocalculate (String message_i)
{
try
{
System.out.println("We are inside the file function");
System.out.println ("Log file is: " + file.getName());
c_objLogFile = new FileWriter (file);
c_objLogFile.write("we are inside");// this is not printed in thje file
c_objLogFile.write(message_i); // this is not printed in the file
}
catch (Exception ge)
{
System.out.println (ge.getMessage ());
}
}
}
---------------------------------------------------------------------
[ July 01, 2006: Message edited by: Raj kalaria ]