ParsePosition getErrorIndex Example

ParsePosition class getErrorIndex example. This example shows you how to use getErrorIndex method.


ParsePosition class getErrorIndex example. public int getErrorIndex() Retrieve the index at which an error occurred, or -1 if the error index has not been set.

Here is the code
/*
 * @ # GetErrorIndex.java
 * A class repersenting use to getErrorIndex method of
 * ParsePosition class in java.text package
 * version 13 June 2008
 * author Rose India 
 */

import java.text.*;

public class GetErrorIndex {

    public static void main(String args[]) {

        // create instance of parse position 
        ParsePosition p = new ParsePosition(10);

        //get error index, or -1 if the error index has not been set.
        System.out.println("Error index " + p.getErrorIndex());

        //set error index
        p.setErrorIndex(1);
        System.out.println("Error index " + p.getErrorIndex());
    }
}

Output
Error index -1
Error index 1

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

HOME | COPYRIGHT | CONTACT US