1024programmer Java Decimal style toString() method in Java, example

Decimal style toString() method in Java, example

Decimal style toString() method in Java, example

Original text: https://www . geesforgeks . org/decimal style-tostring-method-in-Java-with-example/

The toString() method of the Java . time . format . DecimalStyle class in java is used to obtain the string value of this decimal style . This method returns a string representing the string value.

Syntax:

public String toString()

Parameters: This method does not accept any parameters.

Return Value: This method returns a String, which is the decimal-style string value.

Exceptions:This method does not throw any exceptions.

Program:

// Java program to demonstrate
// the above method
import java.time.format .*;
import java.util.*;
public class DecimalStyleDemo {
 public static void main(String[] args)
 {
 DecimalStyle ds1
                                                             span> DecimalStyle.STANDARD;
 DecimalStyle ds2
 = DecimalStyle.of(
                       new Locale("JAPANESE"));
 System.out.println( "String value of DS 1: "
                                                                  /span>.toString());
 System.out. println("String value of DS 2: "
                                     span class="o">+ ds2.toString());
 }
}

Output:

String value of DS 1 : DecimalStyle[0+-.]
String value of DS 2: DecimalStyle[0+-.]

Reference: https://docs . Oracle . com/javase/10/docs/API/Java/time /format/decimal style . html # toString()

This article is from the internet and does not represent1024programmerPosition, please indicate the source when reprinting:https://www.1024programmer.com/decimal-style-tostring-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: 34331943@QQ.com

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
首页
微信
电话
搜索