count the number of occurrences of a digit in a given number in java code example
Example: count the number of occurrences of a character in a string java
String line = "apples.oranges.bananas";
int count = line.length() - line.replace(".", "").length();
System.out.println(count);//displays 2