File–Writing
main
public class writing2 {
public static void main(String[] args) {
writing obj=new writing();
obj.openFile();
obj.add();
obj.close();
}
}
import java.io.File;
import java.util.Formatter;
public class writing {
private Formatter x;
public void openFile()
{
try {
x =new Formatter("shadhi.txt");
}
catch(Exception e){
System.out.println("you have an error");
}
}
public void add()
{
x.format("%s%s%s","20"," new ","number");
}
public void close()
{
x.close();
}
}
No comments:
Post a Comment