I am new in java . I don't know how to debug the error mentioned above in my code . Please help me.
import java.util.*; import java.lang.*; import java.io.*;
class S { public static void main(String args[]){ String s1,s2; Scanner sc = new Scanner(System.in); s1 = sc.nextLine(); s2 = sc.nextLine();
int index=0,sum=0; while(index!=-1){ index = s1.indexOf(s2,index); if(index!=-1){ sum ++; index += s2.length(); } } System.out.println(sum); }
}
try public class S