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

Ronald Greer
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Ronald Greer
Front End Web Development Techdegree Graduate 56,430 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
}