StringCharacterIterator next Example

StringCharacterIterator class next example. This example shows you how to use next method.


StringCharacterIterator class next example. char next() Increments the iterator's index by one and returns the character at the new index. If the resulting index is greater or equal to getEndIndex(), the current index is reset to getEndIndex() and a value of DONE is returned.

Here is the code
/*
 * @ # Next.java
 * A class representing use to next method of
 * StringCharacterIterator class in java.text package
 * version 13 June 2008
 * author Rose India 
 */

import java.text.*;

public class Next {

    public static void main(String args[]) {

        StringCharacterIterator s =
                new StringCharacterIterator("Roseindia");

        for (char ch = s.first(); ch != CharacterIterator.DONE;
                ch = s.next()) {
            System.out.print(s.current());
        }
    }
}

Output
Roseindia

Post Comment
Name:
E-mail:
Contact no :
Comments:
  Refresh Image
Verify Image:
 
 
Your Comment's
 
 
 

HOME | COPYRIGHT | CONTACT US