1for(int i = 0; i < string1.length(); i++) // run loop for length of string1
2 {
3 ch1 = string1.charAt(i);//first character of string1
4
5 for(int u = 0; u < string2.length(); u++)//compare first char of string1, against each in string2
6 {
7 ch2 = string2.charAt(u); //first character of string2
8 if(ch1 == ch2)
9 {
10 matches++; //increment matches found
11 }
12 }
13
14 }
15
16 System.out.println("Number of matches: " +matches);