In this program I have everything running perfectly but in the addRecord() function I need to add more information. But I am not able to print it on a new line.
Everything is displaying in the same line.
Can someone point me out on that.
Thank You..
Everything is displaying in the same line.
Can someone point me out on that.
Code:
import java.io.*;
import java.lang.*;
import java.util.*;
public class createfile {
public static void main(String args[]){
createfile obj= new createfile();
obj.openfile();
obj.addRecords();
obj.closefile();
System.out.println("You have created a file");
}
private Formatter x;
public void openfile(){
try{
x = new Formatter("C:\\test\\chinese.txt");
}
catch(Exception e){
System.out.println("You have an error");
}
}
public void addRecords(){
x.format("%s %s %s","21","alex","software programmer");
x.format("%s %s %s", "22","greg", "architecture");
}
public void closefile(){
x.close();
}
}
Thank You..
Comment