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://docs.oracle.com/javase/7/docs/api/java/text/DecimalFormat.html#getNegativeSuffix()
