The problem is to write a method that counts the number of digits in a String.
This implementation uses Character.isDigit() method to verify whether a character is a digit.
Exercise: Write a program that prompts the user to enter a String and then prints out the number of digits in the String.
Enter string: d#1@bcd23f1gb Number of digits is: 4
Download Code: Count Digits
No comments:
Post a Comment