What is difference between == equals () and compareTo () method in Java?

The 2 main differences are that: equals will take any Object as a parameter, but compareTo will only take Strings . equals only tells you whether they’re equal or not, but compareTo gives information on how the Strings compare lexicographically.

Sizin İçin Seçtik  BtcTurk de alım satım nasıl yapılır?

Leave a Reply

Your email address will not be published. Required fields are marked *

What is difference between == equals () and compareTo () method in Java?

The 2 main differences are that: equals will take any Object as a parameter, but compareTo will only take Strings . equals only tells you whether they’re equal or not, but compareTo gives information on how the Strings compare lexicographically.

Sizin İçin Seçtik  Why compareTo () should be consistent to equals () method in Java?

Leave a Reply

Your email address will not be published. Required fields are marked *