For counting the sum of a digit in a given string, we’re going to code a java program in this article. Example Input Input string: I love Codeforwin. » Contact us » Privacy policy, STUDENT'S SECTION We are using Scanner class to get the input from the user. In this Java count digits, alphabets, and special characters in a string example, we first used for loop to iterate aldisp_str. » LinkedIn Java program to count the number of digits in a given String public class countDigits { public static void main(String[] args) { String s="coding is easier in Java 1234567890"; int count=0; for(int i=0;i

java count number of digits in string 2021