Write code to get Char Count
//package com.book2s; public class Main { public static void main(String[] argv) { String value = "book2s.com"; char c = 'o'; System.out.println(getCharCount(value, c)); }/*from ww w .jav a 2 s .c om*/ public static int getCharCount(String value, char c) { if (value == null) return 0; int count = 0; for (int i = 0; i < value.length(); i++) { if (value.charAt(i) == c) count++; } return count; } }