Thursday, September 4, 2025
HomeLanguagesJavaDecimalFormat getNegativeSuffix() method in Java

DecimalFormat getNegativeSuffix() method in Java

The getNegativeSuffix() method of the DecimalFormat class in Java is used to get the negative suffix value of this DecimalFormat instance.

Syntax:

public String getNegativeSuffix()

Parameters: This method does not accepts any parameter.

Return Value: This method returns negative suffix value of this DecimalFormat instance.

Below program illustrate the above method:




// 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);
    }
}


Output:

negative

Reference: https://docs.oracle.com/javase/7/docs/api/java/text/DecimalFormat.html#getNegativeSuffix()

RELATED ARTICLES

Most Popular

Dominic
32261 POSTS0 COMMENTS
Milvus
81 POSTS0 COMMENTS
Nango Kala
6626 POSTS0 COMMENTS
Nicole Veronica
11795 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11855 POSTS0 COMMENTS
Shaida Kate Naidoo
6747 POSTS0 COMMENTS
Ted Musemwa
7023 POSTS0 COMMENTS
Thapelo Manthata
6695 POSTS0 COMMENTS
Umr Jansen
6714 POSTS0 COMMENTS