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()