This post originated from an RSS feed registered with Java Buzz
by Arpit Mandliya.
Original Post: BigDecimal compareTo Method
Feed Title: Java tutorial for beginners
Feed URL: http://feeds.feedburner.com/arpitmandliyasblog
Feed Description: A blog about java programming language and its frameworks
In this post,we will see about Bigdecimal’s compareTo method.This method is used to compare two BigDecimals. Syntax Return type CompareTo method returns -1,0,1 -1 : First BigDeicmal is less than second BigDecimal 0 : First BigDecimal is equal to second BigDecimal 1 : First BigDecimal is greater than second BigDecimal BigDecimal CompareTo example Let’s see compareTo method with the help of example. Above program will generate below output. First BigDecimal is greater than Second BigDecimal BigDecimal compareTo vs equals Unlike equals method, if two BigDecimals have same value but different scale, compareTo method will return 0.It means compareTo