- /**
- * Strings Practice Test
- *
- * @author Mr. Rogers
- * @version 1-30-2011
- */
- public class StringsPractice {
- public static void
main ( ) {
- String s1
= "cat" ,
-
s2 = "Cats" ,
-
s3 = "cap" ,
-
s4 = "cat " ,
-
s5 = "cats" ;
- // List the value returned.
- /* ______ 1) */
System.out.println (s1.compareTo ( s2 ) ) ;
-
- /* ______ 2) */
System.out.println (s1.compareToIgnoreCase ( s2 ) ) ;
-
- /* ______ 3) */
System.out.println (s1.compareTo ( s4 ) ) ;
-
- /* ______ 4) */
System.out.println (s1.compareTo ( s3 ) ) ;
- /* ______ 5) */
System.out.println (s4.compareTo ( s1 ) ) ;
-
- /* ______ 6) */
System.out.println (s2.compareToIgnoreCase ( s5 ) ) ;
-
- }
- }