Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class StringRecursion
- {
- public static void printLetters(String str)
- {
- if(str==null)
- {
- System.out.println(str);
- }
- else
- {
- System.out.print(str.charAt(0)+", ");
- str=str.substring(1, str.length());
- printLetters(str);
- }
- }
- public static void main(String[] args)
- {
- printLetters("Testing 123");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement