Find the substring count from a string without string functions in java

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;

public class Test
public static void main(String[] args) {
   String test=null;
   String index=null;
   int j=0;
   System.out.println("Enter the string");
   test= new Scanner(;
   System.out.println("Enter the substring you want to count");
   index= new Scanner(;
   for (int i = 0; i <= test.length()-index.length(); i++) {
    String testing=test.substring(i, index.length()+i);
   System.out.println("No of count is "+j);

Post a Comment