gpt4 book ai didi

Java: vector 声明

转载 作者:行者123 更新时间:2023-12-02 12:52:13 31 4
gpt4 key购买 nike

当我输入声明语句时:

Vector<double> distance_vector = new Vector<double>();

我收到错误(在两种情况下都在“双”下划线):

Syntax error on token "double", Dimensions expected after this token

我在这里做错了什么?

最佳答案

您不能使用基元作为类型参数。您需要使用 Vector<Double> (或 even betterList<Double> )或使用 Trove 之一如果您确实需要避免装箱/拆箱的性能影响,请使用集合。

关于Java: vector 声明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11697366/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com