Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

I am getting an infinite loop. Why?

843789Aug 18 2010 — edited Aug 18 2010
This small block of code is giving me an infinite loop. I can't understand why. The file is called "owners.dat" and it only has 10 lines. The purpose of this block of code is to count how many lines are in a file. What the heck is going on here?
			Scanner countFile = new Scanner(new FileReader("owners.dat"));
			while (countFile.hasNextLine())
			{	
				size = size +1;
			}
Thanks for any advice
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 15 2010
Added on Aug 18 2010
3 comments
161 views