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 count = 1;
        String userInput = "this is a test";
        char ch = userInput.charAt(0);
        for (int i = 1; i < userInput.length(); i++) {
            if (userInput.charAt(i) == ch)
                count++;
        }
        System.out.println(count);

    }

}