tags:

views:

82

answers:

2

I want to print no. of a, b, c,etc... Special characters, vowels, consonants in file using Java. how to do that?

+1  A: 
  1. Open the file
  2. Go through the file character by character.
  3. If the current char matches the char you want,increment the counter by one
  4. Detect end of file (EOF) and print the counter value.

Read File Handling , InputStream

Give it a try and if you are stuck at something specific,come back with the specific question.

chedine
+2  A: 
  1. create map <char, int>
  2. read file char by char.
  3. if char in map -> map.put(map.get(char)+1) else map.put(char, 1)
foret
There is no such thing as a `Map <char, int>`. It would have to be a map of wrapper types: `Map <Character, Integer>`
seanizer
I know. I just don't really want to chew everything for topic-starter, because it really looks like homework. Anyway, it is very basic thing, and if topic-starter doesn't know them, i'd recommend to spend some time on learning basics.
foret