Java 中的 DecimalFormat getPositivePrefix()方法
原文:https://www . geeksforgeeks . org/decimal format-getpositiveprefix-method-in-Java/
Java 中十进制格式类的 getPositivePrefix() 方法用于获取这个十进制格式实例的正前缀值。
语法 :
public String getPositivePrefix()
参数:该方法不接受任何参数。
返回值:这个方法返回这个十进制格式实例的正前缀值。
下面程序举例说明上面的方法:
// Java program to illustrate the
// getPositivePrefix() method
import java.text.DecimalFormat;
public class GFG {
public static void main(String[] args)
{
// Create a DecimalFormat instance
DecimalFormat deciFormat = new DecimalFormat();
// Set a positive prefix value
deciFormat.setPositivePrefix("positive");
// Get the positive prefix value
String positivePrefix = deciFormat.getPositivePrefix();
System.out.println(positivePrefix);
}
}
输出:
positive
参考:https://docs . Oracle . com/javae/7/docs/API/Java/text/decimal format . html # get home prefix()
版权属于:月萌API www.moonapi.com,转载请注明出处