This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Java in General and the fly likes StringTokenizer with hasNext method as condition Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Java in General
Bookmark "StringTokenizer with hasNext method as condition" Watch "StringTokenizer with hasNext method as condition" New topic
Author

StringTokenizer with hasNext method as condition

Eric Tan
Ranch Hand

Joined: Oct 11, 2006
Posts: 72
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

Joined: Jun 19, 2001
Posts: 547
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

Joined: Oct 11, 2006
Posts: 72
Thanks alot for the info. I will look into it
Eric Tan
Ranch Hand

Joined: Oct 11, 2006
Posts: 72
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

Joined: Jun 19, 2001
Posts: 547
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

Joined: Oct 11, 2006
Posts: 72
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
Marshal

Joined: Mar 22, 2005
Posts: 42035
    
  64
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.


Ping & DNS - my free Android networking tools app
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: StringTokenizer with hasNext method as condition