|
-
September 29th, 2011, 04:31 PM
#1
Java hashmap help
Hi guys I am trying to read a file of integers that is information about way points into a hashmap. This is what I have so far
import java.io.*;
import java.util.*;
import java.util.HashMap;
import java.util.Iterator;
class Waypoints {
public static void main(String[] args) throws FileNotFoundException {
Scanner scanner = new Scanner(new FileReader("waypoints.txt"));
HashMap<String, String> map = new HashMap<String, String>();
while (scanner.hasNextInt()) {
HashMap.put(scanner.nextInt());
}
System.out.println(map);
}
}
when I try to compile I keep getting this error...
Test.java:16: cannot find symbol
symbol : method put(int)
location: class java.util.HashMap
HashMap.put(scanner.nextInt());
Please help me resolve this or point me in the right direction I'm not even sure if I am on the right way of doing this.
-Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|