扫码下载编程狮APP
public class Main { public static void main(String[] args) { int y = 0; char letter = 'e'; String food = "this is a test"; for (int x = 0; x < food.length(); x++) { if (food.charAt(x) == letter) { y++; } } System.out.println(y); } }
联系方式:
扫描二维码
下载编程狮App
扫码关注 领资料包