Exercise : printLetters
-
Write a method named
printLetters that takes a String as its parameter and that prints the letters of the String, separated by commas.
For example, the call of printLetters("Rabbit") should print:
R, a, b, b, i, t
-
(Hint: This is a fencepost problem.
Remember that each
String object has a length method that tells you how many characters are in the String and a charAt method that gets you individual characters of
the String.)
-
Try solving this problem in Practice-It! using the link above.