If we convert decimal into integer like below code, it will compile without a problem, but at the time of execution, an error will occur.
Decimal mydecval = 15.0; Integer myintval = Integer.valueOf(mydecval);
So, we should always use decimalvariable.intValue() to convert decimal value into integer.
Here is sample code:
Decimal mydecval = 15.0; Integer myintval = mydecval.intValue();