简体   繁体   English

Java NetBeans编译错误

[英]Java NetBeans Compiling Error

When compiling my Code, it highlights this in red: 在编译我的代码时,它会以红色突出显示:

    Note: /Users/myName/NetBeansProjects/CardGame/src/cardgame/Hand.java uses unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.

It still compiles and runs the program without fault (so far)... I was just curious to whether anyone would know whats causing it. 它仍然编译和运行程序没有错(到目前为止)...我只是好奇是否有人会知道什么导致它。 Absolutely nothing appears on google and looking at my "Hand" Class, i can not see anything that should be causing an issue... :( 绝对没有任何东西出现在谷歌和看着我的“手”类,我看不到任何应该导致问题...... :(

In Netbeans, right click on your project > Properties > Compiling > "Additional Compiler Options" and enter: -Xlint:unchecked . 在Netbeans中,右键单击项目>属性>编译>“其他编译器选项”,然后输入: -Xlint:unchecked

Recompile and see what line is generating the warning. 重新编译并查看生成警告的行。

These are not compilation errors, they are some warnings. 这些不是编译错误,它们是一些警告。 They say that you are not using generics or using them in a wrong way somewhere in your code. 他们说你没有在代码中的某个地方使用泛型或以错误的方式使用它们。

For instance, something like this: 例如,像这样:

List list = new ArrayList();

should be: 应该:

List<String> list = new ArrayList<String>();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM