java.util.Scanner sc = new java.util.Scanner(System.in);
System.out.println("请输入字符串..");
String str = sc.next();
System.out.println("请输入要查找的字母..");
String num = sc.next();
int weizhi = 0;
char[] arr = str.toCharArray();
for(int i = 0; i < arr.length; i++){
if(num.equals(String.valueOf(arr[i]))){
weizhi += weizhi+1;
}
}
System.out.println("字符" + num + "出现了 " +weizhi+ " 次.");