FieldPosition getFieldAttribute Example

FieldPosition class getFieldAttribute example. This example shows you how to use getFieldAttribute method.


FieldPosition class getFieldAttribute example. public Format.Field getFieldAttribute() Returns the field identifier as an attribute constant from one of the Field subclasses. May return null if the field is specified only by an integer field ID.

Here is the code
/*
 * @ # GetFieldAttribute.java
 * A class representing use to getFieldAttribute method 
 * of FieldPosition class in java.text package
 * version 17 June 2008
 * author Rose India 
 */

import java.text.*;
import java.math.*;

public class GetFieldAttribute {

    public static void main(String[] args) {
        // Get a default NumberFormat instance.
        NumberFormat numForm = NumberFormat.getInstance();

        // Format some decimals using the pattern supplied above.
        StringBuffer buffer = new StringBuffer(24);
        FieldPosition pos = new FieldPosition(NumberFormat.INTEGER_FIELD);

        BigDecimal bd1 = new BigDecimal(22.222001D);
        buffer = numForm.format(bd1, buffer, pos);
        System.out.println("Field attribute "+pos.getFieldAttribute());
    }
}

Output
Field attribute null

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

HOME | COPYRIGHT | CONTACT US