String compareTo(Object o) method in Java

The compareTo(Object o) method in Java compares the String to another Object.

Syntax

Let us see the syntax,

Parameters

Let us see the parameters,

  • O – object

Example

The following is an example of compareTo(Object o),

Output

The following is the output,

Java String compareto method

String chartAt() method in Java
String compareTo(String anotherString) method in Java
Studyopedia Editorial Staff
contact@studyopedia.com

We work to create programming tutorials for all.

No Comments

Post A Comment

Discover more from Studyopedia

Subscribe now to keep reading and get access to the full archive.

Continue reading