1024programmer Java Decimal format symbol setting symbol (character) method in Java, example

Decimal format symbol setting symbol (character) method in Java, example

Decimal format symbols set symbol (character) method in Java, example

Original text: https://www . geeksforgeeks . org/decimal format symbols-setminssignchar-method-in-Java- with-examples/

Settings‘smethod. The extraction format symbol class in Javais used to set the minus character for the locale of this extraction format symbol. This method takes as argument the character representing the minus sign.

Syntax:

public void setMinusSign(char minusSign)

Parameters:This method accepts Sign as parameter, which is the character used to represent the negative sign of this decimal format symbol.

Return value:This method does not set anything.

Exceptions:This method does not throw any exceptions.

Program:

// Java program to demonstrate
// the above method
import java.text.* ;
import java.util.* ;
public class DecimalFormatSymbolsDemo {
public static void main(String[] args)
  {
 DecimalFormatSymbols dfs
                                                                   new DecimalFormatSymbols();
 System.out.println("Current Character used"
                                                                 + " for minus sign: "
                                                               span>.getMinusSign());
 char minusSign = '*';
 dfs.setMinusSign(minusSign);
 System.out.println("Updated Character used"
                                                              ="o">+ " for minus sign: "
                                                    ">dfs.getMinusSign());
 }
}

Output:

Current Character used for minus sign: -
Updated Character used for minus sign: *

Reference :https://docs . Oracle . com/javase/9/docs/API/Java/text/decimeter format notation. html # getminsign–

This article is from the internet and does not represent1024programmerPosition, please indicate the source when reprinting:https://www.1024programmer.com/decimal-format-symbol-setting-symbol-character-method-in-java-example/

author: admin

Previous article
Next article

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索