当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


Java DecimalFormat getNegativePrefix()用法及代码示例


Java中的DecimalFormat类的getNegativePrefix()方法用于获取此DecimalFormat实例的负前缀值。

用法

public String getNegativePrefix()

参数:此方法不接受任何参数。


返回值:此方法返回此DecimalFormat实例的负前缀值。

以下示例程序旨在说明上述方法:

// Java program to illustrate the 
// getNegativePrefix() method 
  
import java.text.DecimalFormat; 
  
public class GFG { 
  
    public static void main(String[] args) 
    { 
  
        // Create a DecimalFormat instance 
        DecimalFormat deciFormat = new DecimalFormat(); 
  
        // Get the negative prefix value 
        String negativePrefix = deciFormat.getNegativePrefix(); 
  
        System.out.println(negativePrefix); 
    } 
}
输出:
-

参考: https://docs.oracle.com/javase/7/docs/api/java/text/DecimalFormat.html#getNegativePrefix()



相关用法


注:本文由纯净天空筛选整理自gopaldave大神的英文原创作品 DecimalFormat getNegativePrefix() method in Java。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。