Program for counting the occurrence of testing in the String

public class Program {

public static void main(String[] args) {

    String str = "automation testing manual Testing functional Testing regression testing smoke testing Sanity Testing";

    int count = 0; // initialing count

    String[] array = str.split(" "); // Splitting the str String by passing space in the split method

    for (String value : array) {

        if (value.equalsIgnoreCase("testing")) {

            count++;
        }

    }

    System.out.println("Occurrence of testing in the String :" + count);

}

}

Design a site like this with WordPress.com
Get started