Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Java Java Maps Java Maps Java Maps Quiz

Ronald Greer
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Ronald Greer
Front End Web Development Techdegree Graduate 56,280 Points

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,379 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
}