A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
OCA Java SE 8 Programmer I Study Guide 1Z0-808
this week in the
Java in General
next vs hasnext() in Scanner
Joined: Feb 27, 2002
Dec 18, 2004 02:43:00
I am confused between hasnext and next methods in the
class. Please help.
Joined: Dec 03, 2004
Dec 18, 2004 03:21:00
what is the confusion Pradeep?
is it the use of them that's confusing you? Well, hasNext is used to find out whether another token is available, whereas, next is used to get that 'next' token!
hope this helps.
I agree. Here's the link:
subject: next vs hasnext() in Scanner
Iterator in TestNG class
Reading Elements from an ArrayList, 3 at a time
How to iterate a Set (2 steps once)
Why is this hashmap iterating through an infinite loop?
A kinder, gentler API for reading lines
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015