I am getting this error, I have quoted it below, please guide me, in removing them

时间:2016-04-15 11:05:41

标签: java cmd

E:\>javac Cconv.java
Note: Cconv.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

Here Cconv.java is my main class. These are two errors on command screen.

1 个答案:

答案 0 :(得分:1)

This is not an error, it is a warning. Try running your code, it will run normally.

Cconv.java uses unchecked or unsafe operations. 
Note: Recompile with -Xlint:unchecked for details

It is basically shown when exact type is not shown with generic classes.

For example,

ArrayList al = new ArrayList(); //It will produce above mentioned warning.

ArrayList<String> al = new ArrayList<>();   // It will not

In first statement, you are not mentioning the type for which ArrayList is being created and as it is generic so it is unsafe operation, that is what Warning is saying. If you want to avoid it you can compile with -Xlint flag.