Ok ,lets start at the begining.
As String is a final class it cannot be subclassed and as a result the object must be of type string
The compare to method returns a positive or negative value if it is not valued to be true.
So if you do "test".compareTo("t"); it will return a positive number if it were "t".compareTo("test"); it will return a negative number if they are the same then it returns 0. I remeber it by substituting compareTo with a - so test-t=est thats postive and t-test=-est is negative if you know what i mean,
indexOf returns a -1 when it has not found the value in () so -1 is return.
Try running this bit of code it will help:
char t='t';//value of t as an int is 116
System.out.println ("erty".indexOf (116));
hope this helps