ParsePosition setIndex Example
ParsePosition class setIndex example. This example shows you how to use setIndex method.
ParsePosition class setIndex example. public void setIndex(int index) Set the current parse position.
Here is the code
/*
* @ # SetIndex.java
* A class representing use to setIndex method of
* ParsePosition class in java.text package
* version 14 June 2008
* author Rose India
*/
import java.text.*;
public class SetIndex {
public static void main(String[] args) {
// create instance of parse position
ParsePosition p = new ParsePosition(10);
// Retrieve the current parse position.
System.out.println("Current parse position. " + p.getIndex());
p.setIndex(15);
System.out.println("Current parse position. " + p.getIndex());
}
} |
Output
Current parse position. 10
Current parse position. 15 |
|