I have written a class such that is given below as shown that
public class Countletter
{
public static void main(String args[]) throws IOException
{
String str = "muhammed";
char[] Array = str.toCharArray();
for(int i=0;i<8;i++)
{
int count=1;
for(int j=i+1;j<8;j++)
{
if(Array[i]==(Array[j]))
{
count++;
}
}
System.out.println(""+Array[i]+":"+count);
}
}
}
The output should be,
Input : Muhammed
output : m=3
u=1
h=1
a=1
d=1
But my code print like
output : m:3
u:1
h:1
a:1
m:2
m:1
e:1
d:1
anybody know where is my fault? and If anybody knows this logic please help me