public class Search2 { public static void main(String[] a) { String s = "Summer Course"; char c = 'r'; // now I want to find out if the string S contains the character c // i do this using a linear search algorithm and the methdod .charAt() // Improved version: count how many occurrences there are int i = 0; int count = 0; while (i < s.length()) { if (s.charAt(i) == c) { count += 1; } i += 1; System.out.println("i = " + i + ", count = " + count); } System.out.println("I saw this " + count + " times"); } }