sábado, 8 de junio de 2013

Java. Trabajando con Monedas (Currency) e i18n

import static java.lang.System.out;
public class currencyTest{
 public static void main(String args[]){
  /**
  *the java.util.Currency class does not provide a
  *public constructor, therefore you can obtain an
  *instance by calling the getInstance(...) method
  */
  java.util.Currency venezuelasCurrency = 
  java.util.Currency.getInstance(
                     new java.util.Locale("es", "ve"));

  out.printf("The currency symbol for venezuela
                is %s%n", venezuelasCurrency.getSymbol());
 }
}
Imprime:
      The currency symbol for venezuela is BsF.

No hay comentarios:

Publicar un comentario