Skip to content

Insert Dimensions to complete Expression/ReferenceType

I’m a newbie to Java.

I have provided a short snippet from my code for BFS.

public int bfs(Person p, Person q) {
    private HashMap<Person, boolean> marked;
    private int count;

    marked = new marked<Person, boolean>();
    count = new int;

According to Eclipse, I have an error on each of the last 4 lines.

Syntax Error: insert “Dimensions” to complete expression/referencetype.

I would appreciate any input/advice!



Cause of this error -You are trying to pass a primitive object into a generic type declaration whereas generic types always expect a Wrapper Class object. So please use ‘Boolean’ instead of ‘boolean’ in your code i.e. ‘B’ in caps.

9 People found this is helpful