Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

number of repeated characters in string array

843789Jul 14 2010 — edited Jul 15 2010
Hi,
I m trying to get number of repeated characters in string array. I couldnt figure out where am i doing mistake.
thank you,

For example: count({"alpha, beta,"}, 'a')
a is repeated 3
l is repeated 1 etc.

public class Test
{
public static int count(String[] stringArray, char c)
{
public String [] str = new String [2];

int count = 0;
str[0]
str[1]


for(int i = 0; i<str.length(); i++)
if (str.charAt(i)
count++;


return count;
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 12 2010
Added on Jul 14 2010
8 comments
1,337 views