This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
Hello, I would like to know how do I go about getting specified letter from a word, then printing out how many times that letter shows up in the word. Example: String word = "Alabama"; ............... System.out.println ("Letters in word: " + word); I want to get only the letter 'a' from the word, so the result must print out the number "4", since there are 3 letters in the word 'Alabama'. Could someone please give me some examples and how to start this program off? Are there any String/Character classes I should be aware of to do this and if so, which ones? Thank you
Take a look at the Javadocs for String. Lots of good stuff there like: .length() .charAt() .toLowerCase() (if you're not worried about case) Try writing a for loop using the length() and take a look at each character with charAt() That should get you started. Brian