Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

read text

 
brian yuen
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Account class

checking class

Record class

Bank

so the output file would be
:
record.txt
121212,Brian,123456
Account.txt
123456,999.99
what i wanna do is if like
//get an customerId from input, if (customerId == 121212 && accNO(in record.txt) == accNo(in Record.txt)
display the balance(999.99);
how can i do that, i know i can use String Tokenizer scan the text file, but
any better way to get communication between two files?
 
Maverick Lasa
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello brian,
i think you wanted to write the condition as:

i know i can use String Tokenizer scan the text file
you can use String.indexOf and String.substring which I think is a little bit faster than StringTokenizer. any better way to get communication between two files?

what do you mean by "communication between two files"?
why don't you add a Account.readAccount() and Record.readRecord to get the data from their corresponding files, then use the same account and record instances to compare the account number?
the simple, the better
mavedrive;
[ October 24, 2003: Message edited by: Maverick Lasa ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic