Vector 的大小方法导致 "Cannot find Symbol" 错误

Size Method of a Vector resulting in a "Cannot find Symbol" Error

我在使用以下代码时遇到了一些问题,该代码使用向量来存储用户打印的数字列表并计算数字列表的平均值。我遇到的问题是在我的脚本的第 9 行出现 Cannot find symbol 错误,指的是编译器中 returns 的大小方法。我试过多次修复它,不幸的是没有成功!我是 Java 的新手,如有任何帮助,我将不胜感激,以便我可以继续完成编码练习!请在下面找到我的代码并提前致谢:Snippet of the error on the terminal. Script, Using a while loop to add elements to the vector,

使用 MyVector.size() 代替 od MyVector.size

考虑使用 IDE,built-in 检查器会指示错误并建议解决方案,这样对于初学者来说更容易。

顺便说一下,编码约定是以小写字母开头的变量名。