im trying to create a restaurant system that will create food items and such from a menu.
ill be learning jdbc soon and im sure that would help but for now i think the simplest way is too create my menu in notepad.
whats the best way to line up and read from a notepad file like a menu.
please try speak clearly, im not exactly sure of all terminologies.
this one looks promising but ive no idea whats goin on.
/////////////////////////////////////////////////////////////////////
im still stuck with this.
ive decided too make a seperate mthod for reading the file.
ive tried every example i can think of. could someone just show me an example of how too define a files classpath.
if i type menu.txt it just doesnt work.
Have a look at Sun's Java Tutorial
Easiest option is to simply use the Apache Commons IO JAR and import the org.apache.commons.io.FileUtils class. There are many possibilities when using this class, but the most obvious would be as follows;
List<String> lines = FileUtils.readLines(new File("untitled.txt"));
It's that easy.
"Don't reinvent the wheel."
Can I ask what sort of content/data you will be reading from this file as there may be other (even simpler) possibilities?
i.e.
Properties
foo="bar"
String Tokens
foo,bar,fu,baz
Let me know if you require more details with any of the processes I've mentioned.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With