Name ________________________________________
Write a program that asks for names and displays the initials.
What you need is the first letter of each name. There are two ways to get it.
substring(...).
You can use the substring(...) method to get a one-character
substring starting at the beginning of the name.
You can then concatenate this to the first letter from the other name.
charAt(...)
Strings are made up of characters (primitive type char). You can extract the
first character with charAt(...) and proceed pretty much as above.
Which to use? They are both reasonable solutions.
If you were doing a huge amount of computation -- processing hundreds of thousands of names,
it would be more efficient to use the charAt(...) solution because it's more
efficient to use a primitive type than an object type.
On the other hand, the substring(...) solution has the simplicity
of working with only one type (String).
Use either one.