• Kurse
  • Code Compiler
  • Diskutieren
  • Preise
  • Teams
Menu
+ 1

Differentiate between compareTo() and equals().

this question cost me class highest in preboards.... 😭😭😭😭

java
29th Nov 2017, 3:01 PM
Divyansh Saxena
Divyansh Saxena - avatar
2 Antworten
+ 5
compareTo() returns -1, 0, & 1 for <, =, & >. It lets you perform <= and >= by using the normal operators with 0. equals() returns true when both have same value and false otherwise.
29th Nov 2017, 3:11 PM
John Wells
John Wells - avatar
+ 4
https://www.leepoint.net/data/expressions/22compareobjects.html https://docs.oracle.com/javase/7/docs/api/java/lang/Comparable.html https://www.tutorialspoint.com/java/java_string_compareto.htm https://www.javatpoint.com/java-string-compareto https://beginnersbook.com/2013/12/java-string-compareto-method-example/ https://www.javatpoint.com/java-string-equals https://www.javaworld.com/article/2072762/java-app-dev/object-equality.html
29th Nov 2017, 3:08 PM
AgentSmith

Häufig solche Fragen?

Effizienter lernen, kostenlos:

  • Einführung in Python

    7.1M Lernende

  • Einführung in Java

    4.7M Lernende

  • Einführung in C

    1.5M Lernende

  • Einführung in HTML

    7.5M Lernende

Alle Kurse anzeigen
Heute heiß
debate which is better
6 Votes
Text editor
0 Votes
Debugging issue?
0 Votes
Mobile app not working sometimes
0 Votes
Which one should I start with to learn python. The developer path or both seperate beginner and intermediate python?
0 Votes
Is anyone else having this issue?
2 Votes
how to view only application
0 Votes
If very confusing
0 Votes
Arduino
2 Votes
I’m really confused
0 Votes