Hey guys my names scott and this is my first post. I just recently started using java and am still very basic.
I want to read a certain amount of lines of text from a file. I'm not sure which loop to use can anyone give me a hand ?
Thanks Scott
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
Hey guys my names scott and this is my first post. I just recently started using java and am still very basic.
I want to read a certain amount of lines of text from a file. I'm not sure which loop to use can anyone give me a hand ?
Thanks Scott
What have you tried?
Tried a while loop. But i only know how to scan next line untill there is no more. Im not sure how to read a certain amount of lines. This is what i need a bit of help with.
If I want to do something let's say 10 times, there are a few different ways:
for(int i = 0; i < 10; i++){ //do something }
int i = 0; while(i < 10){ //do something i++; }
Experiment with them.
Control Flow Statements (The Java™ Tutorials > Learning the Java Language > Language Basics)
welikedogs (November 3rd, 2010)
The OP also posted an obscene response on the other forum when called out for cross posting and homework dumping.
db