📜  Java中的 DecimalFormat getNegativeSuffix() 方法

📅  最后修改于: 2022-05-13 01:54:33.165000             🧑  作者: Mango

Java中的 DecimalFormat getNegativeSuffix() 方法

Java中DecimalFormat类的getNegativeSuffix()方法用于获取这个DecimalFormat实例的负后缀值。

语法

public String getNegativeSuffix()

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

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

下面的程序说明了上述方法:

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

参考:https: Java/text/DecimalFormat.html#getNegativeSuffix()