0
can any one help me with this code error is in line 9 and 19 (program to find and count repeated alphabet)
public class countRepate { public static void Repeat(String sent,int n,int count){ if(n>sent.length()){ return; } char curr=sent.charAt(n); for(int i=0;i<=sent.length();i++){ if(n!=i){ if(curr == sent.charAt(i)){ count+=1; } } } System.out.println(curr+" : "+count); Repeat(sent, n+1,0); } public static void main(String args[]){ String Sen="ssddetfyghghi"; Repeat(Sen,0,0); } }
1 Antwort
+ 2
Sahil Jadhav
1 - if(n > sent.length() - 1)
2 - for(int i = 0; i < sent.length(); i++)