String Methods


You can do quite a few things with Strings and something called StringBuffers. In this lesson we will inspect a few of the common methods available in the String class and the StringBuffer class. Let's start off with a little demonstration applet:


Discussion: This applet demonstrates several String class methods and one StringBuffer class method. The following pages give somewhat more detailed information on the String and the StringBuffer classes.

String Class
StringBuffer Class

---------------------------------------------------------------
Assignment:
First of all, disregard the sample assignment on the StringBuffer page. You should read it over and see if you can understand it and possible think about how you might implement it, but you don't have to actually complete that assignment.

Your actual assignment is to write an applet which takes a list of words as input and then sorts these words from longest to shortest. For instance if a user inputs:

   go elephant tree mule box crow yellow mountain hike
The program would provide the following output:
   elephant mountain yellow tree mule crow hike box go