Can I use compareTo to sort integer and double values? My system gives me an error that I Cannot invoke compareTo(int) on the primitive type int. any ideas?
Code:
Change the code
int price;
to
Integer price;
because primitive types such as int will not support any methods, like compareTo().
int
compareTo()