Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java Java Maps Java Maps Java Maps Quiz

Not sure why this isn't working

Im having trouble with question 3 out of 5 I've been putting "Map<String, String>" But nothing seems to be working if anyone one can tell me what I'm doing wrong that would be amazing.

1 Answer

Brad Wagner
Brad Wagner
9,392 Points

Because we are mapping Students to Grades and they have provided us with two classes named 'Student' and 'Grade' we use them as the Types for the Map. This will map 'Student' objects as the KEY and 'Grade' objects as the VALUE.

import java.util.HashMap;
import java.util.Map;

public class Main {
    public static void main(String[] args) {
        Map<Student,Grade> studentGradeMap = new HashMap<>(); 
    }
}

class Student {
    // omitted
}

class Grade {
    // omitted
}

Thank you Brad your comment helped out a lot.