import java.util.*;

public class Homework11 {

Scanner input = new Scanner(new File("keyvalues.txt"));
Map<String, Integer> wordCountMap = getCountMap(in);

	for (String word: wordCountMap.keySet()) {
		int count = wordCountMap.get(word);
		
 while (input.hasNextLine()) {
	 	line = input.nextLine();
		numLine++;
	 	Scanner word = new Scanner(line);
		while (word.hasNext()){
			String nextWord = word.next();
			numWord++;
			numChar = numChar + nextWord.length();
		}

if (wordCountMap.containsKey(name)) {
	double word = wordCountMap.get(name);
	System.out.println(name + "'keyword is $" );
} else {
	System.out.prinln("that wont work " + name);
			}
		}
	}
}

just have a problem with for (String word: wordCountMap.keySet()) {
i hope thats it

Recommended Answers

All 3 Replies

Use code tags and give better information. What do you mean you "hope that's it"? It is relatively easy to pinpoint a problem to a section of code. Did the code before that point execute properly? Did the code after it ever execute at all?

Use code tags and give better information. What do you mean you "hope that's it"? It is relatively easy to pinpoint a problem to a section of code. Did the code before that point execute properly? Did the code after it ever execute at all?

yeah correct... code will never compile..
I think it is not a full code...

code outside of methods....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.