In this example working of Java bigdecimal class shortValueExact method is demonstrated. Method return type is short therefore it will return only short values. Method converts bigdecimal in to short data type value. In the example one bigdecimal object mass is created. Method throws NumberFormatException if it finds any other value to be converted in to short other than integers and decimals. Method also throws ArithmeticException if the value contains non-zero fractional part.
Syntax for using the method: public short
short sh = this.object.shortValueExact();
Rs. 20,000 US$ 300
Today: Rs. 10,000 US$150
Course Duration: 30 hrs
Posted on: November 24, 2008 If you enjoyed this post then why not add us on Google+? Add us to your Circles