Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

What is the issue compareTo() method in Java?public int compareTo(Object o){ Employee emp = (Employee) emp; return this.id - o.id;} id integer

user-image
Question ajoutée par Muhammed Rahshad Koyippalli , Cisco DNAC Senior Escalation Engineer , Cisco Systems - India
Date de publication: 2014/05/24
Naser Ali
par Naser Ali , Technical Specialist , Robert Bosch Engineering and Business Solutions India Pvt. Ltd

When you use subtraction, there is a possibility that you might overrun the limit of the integers and it might return a bad result. Because integer ranges from -32767 to +32768... so when you overstep this range through subtraction, it may produce undesired results.

More Questions Like This

Avez-vous besoin d'aide pour créer un CV ayant les mots-clés recherchés par les employeurs?