I am creating an anagram program which compares two strings and am unsure how to go about creating a boolean that returns true if a character appears in both words.
My code is as follows:
StringBuffer strbuff1 = new StringBuffer("");
private StringBuffer strbuff2 = new StringBuffer("");
public Anagram (String s1, String s2) {
s1 = strbuff1.toString();
s2 = strbuff2.toString();
}
public boolean contains(char chart1) {
return true; //what do I put here?
}
}