This week's book giveaway is in the Java 9 forum.
We're giving away four copies of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications and have Sander Mak & Paul Bakker on-line!
See this thread for details.
Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

read text  RSS feed

 
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 ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!