Use a variable to count the number of lines read and displayed. End the loop when the counter says 5 lines have been processed.
Hint: the condition used by the while statement can have multiple...
Type: Posts; User: Norm
Use a variable to count the number of lines read and displayed. End the loop when the counter says 5 lines have been processed.
Hint: the condition used by the while statement can have multiple...
The Scanner class's methods are easier to use for reading text files.
You should NOT name your classes with the same name as classes in Java SE.
Take a look at the tutorial:
The for Statement (The Java™ Tutorials > Learning the Java Language > Language Basics)
The while and do-while Statements (The Java™ Tutorials > Learning the Java...