Java by API/java.util/Currency

Материал из Java эксперт
Перейти к: навигация, поиск

Currency: getDefaultFractionDigits()

/*
 * Output: 
Symbol: $
Default fractional digits: 2
 */
import java.util.Currency;
import java.util.Locale;
public class MainClass {
  public static void main(String args[]) {
    Currency c;
    c = Currency.getInstance(Locale.US);
    System.out.println("Symbol: " + c.getSymbol());
    System.out.println("Default fractional digits: "
        + c.getDefaultFractionDigits());
  }
}





Currency: getInstance(Locale loc)

/*
 * Output: 
Symbol: $
Default fractional digits: 2
 */
import java.util.Currency;
import java.util.Locale;
public class MainClass {
  public static void main(String args[]) {
    Currency c;
    c = Currency.getInstance(Locale.US);
    System.out.println("Symbol: " + c.getSymbol());
    System.out.println("Default fractional digits: "
        + c.getDefaultFractionDigits());
  }
}





Currency: getSymbol()

/*
 * Output: 
Symbol: $
Default fractional digits: 2
 */
import java.util.Currency;
import java.util.Locale;
public class MainClass {
  public static void main(String args[]) {
    Currency c;
    c = Currency.getInstance(Locale.US);
    System.out.println("Symbol: " + c.getSymbol());
    System.out.println("Default fractional digits: "
        + c.getDefaultFractionDigits());
  }
}