Source of SubString.java


  1: // Fig. 29.6: SubString.java
  2: // String class substring methods.
  3: 
  4: public class SubString 
  5: {
  6:    public static void main( String args[] )
  7:    {
  8:       String letters = "abcdefghijklmabcdefghijklm";
  9: 
 10:       // test substring methods
 11:       System.out.printf( "Substring from index 20 to end is \"%s\"\n",
 12:          letters.substring( 20 ) );
 13:       System.out.printf( "%s \"%s\"\n", 
 14:          "Substring from index 3 up to, but not including 6 is",
 15:          letters.substring( 3, 6 ) );
 16:    } // end main
 17: } // end class SubString
 18: 
 19: 
 20: /**************************************************************************
 21:  * (C) Copyright 1992-2005 by Deitel & Associates, Inc. and               *
 22:  * Pearson Education, Inc. All Rights Reserved.                           *
 23:  *                                                                        *
 24:  * DISCLAIMER: The authors and publisher of this book have used their     *
 25:  * best efforts in preparing the book. These efforts include the          *
 26:  * development, research, and testing of the theories and programs        *
 27:  * to determine their effectiveness. The authors and publisher make       *
 28:  * no warranty of any kind, expressed or implied, with regard to these    *
 29:  * programs or to the documentation contained in these books. The authors *
 30:  * and publisher shall not be liable in any event for incidental or       *
 31:  * consequential damages in connection with, or arising out of, the       *
 32:  * furnishing, performance, or use of these programs.                     *
 33:  *************************************************************************/