Guys please i need help about creating a sequential file using java, im kinda new in this world of java...please!!

something like this:

int main()
{
ofstream outclientfile("client.dat", ios::out);

if(!outClientFile)
{
cerr<<"statement"<<endl;
exit(1);
}

cout<<"Enter the account, name and balance."<<endl
<<"Enter end-of-file" to end input.";

int account;
char name[25];
double balance;

while (cin>>account>>name>>balance)
{
outclientfile<<account<<' '<<name<<' '<<balance<<endl;
cout<<"?";
}
return 0; .....

i need something of this nature but this is a C++ code i need a java code guys please!!

Here's how to do file writing.

File myFile = new File("client.dat");
BufferedWriter out = new BufferedWriter(new FileWriter(myFile));
String output = "statement";
out.write(ouput, 0, output.length());
out.newLine();
...
...
...
out.flush();
out.close();