Insert Dimensions to complete Expression/ReferenceType

meesinlid picture meesinlid · Jan 19, 2016 · Viewed 61.3k times · Source

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!

Answer

Satyendra Sharma picture Satyendra Sharma · Sep 2, 2017

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.