Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

StringTokenizer with hasNext method as condition

 
Eric Tan
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is my code using File Reader and BufferedReader. I have a minor problem whereby i want to perform a method to check whether is there any additional data in every line in the text file. if yes, it will continue to display, if not, it will then stop. i know i could use hasNext but i couldn't get the condition right. could someone help me on this? thanks alot.

 
pascal betz
Ranch Hand
Posts: 547
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
here is some pseudocode:

in each conditional (e.g. the while loops) you can add additional conditions:

and you can modify these additional conditions inside the loop



hope this helped....
pascal
 
Eric Tan
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks alot for the info. I will look into it
 
Eric Tan
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If i want to insert my data into the database, must i use an array to do that? because i have to display out the data stored in eclipse and insert into the database at the same time. or i do not have to create array in order to perform this method? thanks alot!
 
pascal betz
Ranch Hand
Posts: 547
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what database are you using ?
assuming it is a "real" database (and not just a file) you probably want to use JDBC. this is a completely different story again...

i suggest you read up on JDBC, install a DB, try to make some simple examples and then get back to your original problem.

pascal
 
Eric Tan
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I m using db4o as my database. It's a open source database. So it doesn't require jdbc. Just add the external jar file. =) Thanks alot for your help
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Eric Tan:
It's a open source database. So it doesn't require jdbc.


Non sequitur?

IIRC, db4o is an object database, so JDBC can't be used, even if one wanted to.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic