Skip to Main Content

Java Programming

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!

Method(String, char) not applicable for the arguments()

807606May 16 2007 — edited May 16 2007
Hi. Im trying to run this method that I made but I cant coz I always get this error. the ff is my code:

class Sample {

private String word = "apple";
private char a = 'p';

public static void main(String[] args)
{
callingCounter();
}

public int counter(String word, char a)
{
int position = 0;
for (int i=0; i<word.length(); i++)
{
position = word.indexOf(a);
System.out.println(position);
}

return position;
}

public int numberOfLetters(String word, char a)
{
return numberOfLetters;
}
}


thanks a lot
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 13 2007
Added on May 16 2007
2 comments
443 views