Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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);
    }
}