Sunday, 29 November 2015

How get BigdecimalEnum value in java

package com.org.vipul;

import java.math.BigDecimal;

public class BigdecimalEnum {

public static void main(String[] args) {
System.out.println(Vat.FIVE.getValue());

}

public enum Vat {
ONE(new BigDecimal("1")), TWO(new BigDecimal("2")), THREE(
new BigDecimal("3")), FIVE(new BigDecimal("5"));

private final BigDecimal value;

Vat(BigDecimal val) {
value = val;
}

public BigDecimal getValue() {
return value;
}
}
}

No comments:

Post a Comment