ClosedLab05a author version 20141010 public class ClosedLab05a public static String str public static int count digits int len str length int count 0 for int i 0 i len i if Character isDigit str charAt i count return count public static String reverse string int len str length char temp str toCharArray for int i 0 i len 2 i char ch temp i temp i temp len i 1 temp len i 1 ch return String valueOf temp public static void main String args throws Exception Scanner input new Scanner System in Exercise 1 System out print Enter a string to count the digits in str input next System out println Your string contains count digits digits Exercise 2 System out print Enter a string to reverse str input next System out println reverse string
View Full Document