插入尺寸以完成Expression/ReferenceType [英] Insert Dimensions to complete Expression/ReferenceType

查看:75
本文介绍了插入尺寸以完成Expression/ReferenceType的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Java的新手.

我从我的BFS代码中提供了简短的代码段.

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;
}

根据Eclipse,最后4行中的每行都有一个错误.

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

语法错误:插入维度"以完成表达式/引用类型.

Syntax Error: insert "Dimensions" to complete expression/referencetype.

我将不胜感激!

推荐答案

此错误的原因-您试图将原始对象传递给泛型类型声明,而泛型类型始终希望使用Wrapper类对象.因此,请在代码中使用布尔"而不是布尔",即大写字母为"B".

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.

这篇关于插入尺寸以完成Expression/ReferenceType的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆