首页 > 代码库 > 22.2

22.2

技术分享

import java.io.File;
import java.io.FileNotFoundException;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;

public class S22_2 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Map<String,Integer> myMap = new HashMap<String,Integer>();
		File myFile = new File("txt.txt");
		try {
			Scanner input = new Scanner(myFile);
			while(input.hasNext()){
				String str = input.next().toLowerCase();
				if(myMap.get(str) == null){
					myMap.put(str, 1);
				} else {
					int value = http://www.mamicode.com/myMap.get(str).intValue();"\t" +
		entry.getValue());
	}

}

  

22.2