Q:

How to convert string to double

  double d=0.0;
    for (String k : word.keySet()) {
        System.out.println(k + "\t" + word.get(k));           
        d+=Double.valueOf(word.get(k));
        d+=word.get(k);
        word.get(k);
    }
  System.out.println("Value\t"+d);

The values are in hashmap. Incompatible type error occurs in 5th line.how to correct it?

A:

The line d+=Double.valueOf(word.get(k)); will correctly add the Double value of word.get(k) to your double d, provided the String is parsable as Double. 
The line after it, however, adds a String to a double, which will not compile. 
The last line in your loop doesn't make any sense, you are invoking get without actually using the value. 

