Re: hasNext?
- From: sihle87@xxxxxxxxx
- Date: Thu, 28 Feb 2008 03:47:18 -0800 (PST)
i think what you want is "hasNext()".
forgive me if i'm mistaken but method "hasNext()" is a boolean method
which returns either true or false, depending on the expression @
hand.
for an instance, suppose you have a string as follows:
String str="my problems are gone!";
//(say) you want to print tokens(just words of the string) you'll do
the following.
while(str.hasNext())//here you are actually asking whether is it still
true that string str has a
//token? if its true, then there is a token,
otherwise, you won't enter the loop.
{
System.out.println(str.next());
}
---------------------------the
output----------------------------------------------------------------
my
problems
are
gone!
-----------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------"i stand to be corrected though"-but that what i know.
sihle87
University of KwaZulu-Natal(South Africa)
Actuarial Student
-----------------------------------------------------------------------------------------------------
.
- Follow-Ups:
- Re: hasNext?
- From: KyoGaSuki
- Re: hasNext?
- References:
- hasNext?
- From: KyoGaSuki
- hasNext?
- Prev by Date: Re: Why is Applet Slower than Application?
- Next by Date: Deserialization of Java objekts -tricky!
- Previous by thread: Re: hasNext?
- Next by thread: Re: hasNext?
- Index(es):
Relevant Pages
|
|