NumberFormat Clone() Example
Returns a clone of this instance.
NumberFormatclass Clone() method example. This example shows you how to use Clone() method.This methodReturns a clone of this instance.
Here is the code:-
/**
* @Program that Returns a clone of this instance.
* Clone.java
* Author:-RoseIndia Team
* Date:-17-Jun-2008
*/
import java.text.*;
public class Clone {
public static void main(String[] args) {
////Creating Numberformat instance
NumberFormat nf = NumberFormat.getInstance();
//Returns a clone of this instance.
NumberFormat nf1 = (NumberFormat) nf.clone();
//Gets the currency used by this number format
System.out.println("Currency used by this number format: "+nf1.getCurrency());
}
} |
Output of the program:-
| Currency used by this number format: INR |
|