1. Show that the methods compareTo and equals are inconsistent for the class BigDecimal. That is, find two instances, b1 and b2, of BigDecimal such that b1.compareTo(b2) is zero but b1.equals(b2) is...


1. Show that the methods compareTo and equals are inconsistent for the class BigDecimal. That is, find two instances, b1 and b2, of BigDecimal such that b1.compareTo(b2) is zero but b1.equals(b2) is false. Hint: Consider numbers with equal values but different precisions.


2. Define a Java interface called Growable to provide certain behaviors for various plant objects. Growable plants can be watered and fed. Define a class called Rose that implements the Growable interface. Create a client to demonstrate the use of your class.



May 18, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here