fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. String str1 = "Strings are immutable";
  13. String str2 = "Strings are immutable";
  14. String str3 = "Integers are not immutable";
  15.  
  16. int result = str1.compareTo( str2 );
  17. System.out.println(result);
  18.  
  19. result = str2.compareTo( str3 );
  20. System.out.println(result);
  21.  
  22. result = str3.compareTo( str1 );
  23. System.out.println(result);
  24. }
  25. }
Success #stdin #stdout 0.12s 320576KB
stdin
Standard input is empty
stdout
0
10
-10