Hi all,
I am working through the
Java Tutorial third edition and one of the exercises is to write a program that computes your initials from your full name and displays them. I set the app up to accept the full name from the command line. My thought was to first append the first letter of the
string to a StringBuffer then iterate through the string and append the character after a blank space to the StringBuffer. The output only prints the first letter of the string though. After some experimentation it seems that when I use the toString method on the StringBuffer it removes the whitespaces so the loop never finds a blank space. Can any explain why this is and how can I get around it?
Thanks in advance!! Here's my code: