DecimalFormatSymbols SetInfinity() Example
Sets the string used to represent infinity.
DecimalFormatSymbolsclass SetInfinity() method example. This example shows you how to use SetInfinity() method.This method Sets the string used to represent infinity.
Here is the code:-
/**
* @Program that Sets the string used to represent infinity.
* SetInfinity.java
* Author:-RoseIndia Team
* Date:-14-Jun-2008
*/
import java.text.*;
public class SetInfinity {
public static void main(String[] args) {
DecimalFormatSymbols dfs = new DecimalFormatSymbols();
String c = dfs.getInfinity();
System.out.println("The string used to represent infinity: " + c);
dfs.setInfinity("~");
System.out.println("The string used to represent infinity: " +dfs.getInfinity());
}
} |
Output of the program:-
The string used to represent infinity: ∞
The string used to represent infinity: ~ |
|