// TODO code application logic here
String str = "Example program. Here we use a char array.";
char chr[] = str.toUpperCase().toCharArray();
int x[] = new int[256];
for(int i=0;i<chr.length;i++)
{
x[(int)(chr[i])]++;
}
for(int i=0;i<x.length;i++)
{
if(x[i]>0)
{
System.out.println("'"+(char)(i)+"' --> "+x[i]+"\n");
}
}
}
Hasil Running Program di Atas |
Tidak ada komentar:
Posting Komentar