import java.io.*;
public class CountCharacters {
/**
* This method count the characters of a string.
* @param stringToCount the string to count.
* @return int Obtains the number of characters of the string.
*/
public int countCharacters(String stringToCount) {
//Variable to store the total sum
int total = 0;
//Sum the two numbers
total = stringToCount.length();
//Return the total
return total;
}
/**
* One Example
*/
public static void main(String args[]) throws IOException {
CountCharacters countCharacters= new CountCharacters ();
//Example
int sum = countCharacters.countCharacters("Hola");
//Output
System.out.println("Sum of 10 and 20 is :" + sum); //30
}
}
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)