Since Strings cannot be modified, the String methods work differently than the Graphics methods we have used so far. All of those methods modify the Graphics object they are invoked on (by drawing on it); String methods tell us things about the object they are invoked on (there are also Graphics methods tell us things about Graphics objects).
For example, we may need to know how many characters are in a String. The API documentation says there is a method called length that tells us that information. The API also says length returns an int. That int is what holds the number of characters in the string.
If we need to save that value to use later, we must have an identifier by which we can refer to it. That identifier must be declared by giving the type of the value it holds (int in this case). Once the indentifier has been declared we can store length's return value in it using the assignment operator =. For example,
String s = new String("This is sort of a long string but not the longest I've ever seen");
int sLen; // declaration
sLen = s.length(); // initialization
Having done this, if we need to use the length of the string somewhere later in our code, we can write the identifier we just defined. For example, s.substring(1, sLen) would return a the String "his is sort of a long string but not the longest I've ever seen" (see the API documentation for substring).
The work of converting the input to the output is to be done in a method called process in the ParserApplet class. process takes as its parameter the input String and returns the output String. You should add code to process so that it does the following (do not modify any of the other code in ParserApplet):
You will have to read the API documentation for String and StringBuffer to find the methods and constructors to use.
Check you code with some test inputs. Does it work if there are hyphens in the last name? If not, try to fix it. Can you think of names for which the code still would not work properly? (Do not attempt to modify your code to fix such problematic inputs).